• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Space类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Space的典型用法代码示例。如果您正苦于以下问题:C# Space类的具体用法?C# Space怎么用?C# Space使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Space类属于命名空间,在下文中一共展示了Space类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            using (var space = new Space())
            {

            }
        }
开发者ID:veggielane,项目名称:SharpEngine,代码行数:7,代码来源:Program.cs


示例2: OnRemovalFromSpace

 /// <summary>
 /// Called before an object is removed from its space.
 /// </summary>
 public override void OnRemovalFromSpace(Space oldSpace)
 {
     for (int i = 0; i < solverUpdateables.Count; i++)
     {
         solverUpdateables[i].OnRemovalFromSpace(oldSpace);
     }
 }
开发者ID:Raverenx,项目名称:GameEngine,代码行数:10,代码来源:SolverGroup.cs


示例3: OnReset

 public override void OnReset()
 {
     if (translation != null) {
         translation.Value = Vector3.zero;
     }
     relativeTo = Space.Self;
 }
开发者ID:rjchart,项目名称:Project_YSS_2D,代码行数:7,代码来源:Translate.cs


示例4: Reset

 public override void Reset()
 {
     gameObject = null;
     moveVector = new FsmVector3 {UseVariable = true};
     space = Space.World;
     perSecond = true;
 }
开发者ID:Streek,项目名称:FSM-Action-Collection-for-UN-PM,代码行数:7,代码来源:ControllerMove.cs


示例5: Awake

    // Use this for initialization
    void Awake()
    {
        Debug.Assert(SaveGameEventSubscription == null && AutoSaveGameEventSubscription == null);
        SaveGameEventSubscription= MessageHub.Subscribe<SaveGameEvent>(SaveGame);
        AutoSaveGameEventSubscription = MessageHub.Subscribe<AutoSaveGameEvent>(AutoSaveGame);

        mapData = new CollectedMapData();

        space = GameObject.Find("Space").GetComponent<Space>();
        if (space == null)
        {
            throw new MissingComponentException("Unable to find Space. The big bang doesn't have enough space to happen. The 'Space' game object also needs to be added to the level and have the space script attached.");
        }

        airTrafficControl = GameObject.Find("AirTrafficControl").GetComponent<AirTrafficControl>();
        if (space == null)
        {
            throw new MissingComponentException("Unable to find AirTrafficControl. There can't be any troops flying around without an global AirTrafficControl GameObject that has an AirTrafficControl Script attached.");
        }

        gameState = GameObject.Find("2D_MainCam").GetComponent<GameState>();
        if (gameState == null)
        {
            throw new MissingComponentException("Unable to find GameState. The 'GameState' script needs to be attached to the same Gameobject as the BigBang.");
        }
        playerManager = GameObject.Find("PlayerManagement").GetComponent<PlayerManager>();
        if (playerManager == null)
        {
            throw new MissingComponentException("Unable to find playerManager.");
        }
    }
开发者ID:simonides,项目名称:space_concept,代码行数:32,代码来源:GameSaver.cs


示例6: SetZ

 public static void SetZ(this Transform transform, float z, Space space = Space.Self)
 {
     if (space == Space.Self)
         transform.localPosition = transform.localPosition.ScaleBy(1, 1, 0) + z*Vector3.forward;
     else
         transform.position = transform.position.ScaleBy(1, 1, 0) + z*Vector3.forward;
 }
开发者ID:fatiguedartist,项目名称:Sisyphus,代码行数:7,代码来源:RDVectorExtensions.cs


示例7: Done

        public void Done()
        {
            if (SpaceName != null)
                SpaceName = SpaceName.Trim();
            if (string.IsNullOrWhiteSpace(SpaceName))
            {
                MessageBox.Show("Profile name is empty", "Locality", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            if (SpaceName.Length > 30)
            {
                MessageBox.Show("Profile name is too long", "Locality", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            foreach (var spc in App.Instance.Config.Spaces)
                if (spc.Name.Equals(SpaceName, StringComparison.InvariantCultureIgnoreCase))
                {
                    MessageBox.Show("This profile already exists", "Locality", MessageBoxButton.OK, MessageBoxImage.Warning);
                    return;
                }

            var s = new Space { Name = SpaceName, Id = Guid.NewGuid().ToString() };
            App.Instance.Config.Spaces.Add(s);
            (Parent as RootViewModel).Back();
        }
开发者ID:Eugeny,项目名称:Locality,代码行数:26,代码来源:AddSpaceViewModel.cs


示例8: SetY

 public static void SetY(this Transform transform, float y, Space space = Space.Self)
 {
     if (space == Space.Self)
         transform.localPosition = transform.localPosition.ScaleBy(1, 0, 1) + y*Vector3.up;
     else
         transform.position = transform.position.ScaleBy(1, 0, 1) + y*Vector3.up;
 }
开发者ID:fatiguedartist,项目名称:Sisyphus,代码行数:7,代码来源:RDVectorExtensions.cs


示例9: Reset

 public override void Reset()
 {
     this.gameObject = null;
     this.space = Space.World;
     this.storePosition = null;
     this.everyFrame = false;
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:7,代码来源:GetVertexPosition.cs


示例10: AttachGO

        public void AttachGO(Transform dest, Transform source, Vector3 position, Quaternion rotation, Vector3 scale,
            Space space = Space.Self)
        {
            if (source == null)
                return;

            if (dest == null)
            {
                source.parent = null;
            }
            else
            {
                source.parent = dest.transform;
            }
            if (space == Space.Self)
            {
                source.transform.localPosition = position;
                source.transform.localRotation = rotation;
            }
            else
            {
                source.transform.position = position;
                source.transform.rotation = rotation;
            }
            source.transform.localScale = scale;
        }
开发者ID:TheManatthegate,项目名称:Goranee,代码行数:26,代码来源:GameObjectUtil.cs


示例11: Reset

		public override void Reset()
		{
			gameObject = null;
			space = Space.World;
			storePosition = null;
			everyFrame = false;
		}
开发者ID:DIGM680,项目名称:NarrativePlatformer,代码行数:7,代码来源:GetVertexPosition.cs


示例12: OnReset

 public override void OnReset()
 {
     if (eulerAngles != null) {
         eulerAngles.Value = Vector3.zero;
     }
     relativeTo = Space.Self;
 }
开发者ID:TrojanFighter,项目名称:U3D-DesignerBehaviorTest1,代码行数:7,代码来源:Rotate.cs


示例13: Update

    void Update()
    {
        if (!Application.isEditor)
        {
            Destroy(this);
            return;
        }

        if (FreezePosition)
        {
            // Save current position if enabled
            if ((FreezePosition != m_OldFreezePosition) || (space != m_OldSpace))
                m_Position = (space == Space.World) ? transform.position : transform.localPosition;
            // Freeze the position
            if (space == Space.World)
                transform.position = m_Position;
            else
                transform.localPosition = m_Position;
        }

        if (FreezeRotation)
        {
            // Save current rotation if enabled
            if ((FreezeRotation != m_OldFreezeRotation) || (space != m_OldSpace))
                m_Rotation = (space == Space.World) ? transform.rotation : transform.localRotation;
            // Freeze the rotation
            if (space == Space.World)
                transform.rotation = m_Rotation;
            else
                transform.localRotation = m_Rotation;
        }
        m_OldSpace = space;
        m_OldFreezePosition = FreezePosition;
        m_OldFreezeRotation = FreezeRotation;
    }
开发者ID:TerronUA,项目名称:LagstersTestBed,代码行数:35,代码来源:FreezeObject.cs


示例14: AddForce2D

    /// <summary>
    /// Function for applying a specific type of force to a Rigidbody2D (since the default functionality is incomplete)
    /// </summary>
    /// <param name="rb2d">Rigidbody2D to apply the force to</param>
    /// <param name="force">The amount of force to apply</param>
    /// <param name="mode">What type of force to apply</param>
    /// <param name="relativeTo">Should the force be applied in the rigidbody's local space, or world space?</param>
    public static void AddForce2D(this Rigidbody2D rb2d, Vector2 force, ForceMode mode = ForceMode.Force, Space relativeTo = Space.World)
    {
        ForceMode2D mode2D = ForceMode2D.Force;
        Vector2 forceApplied = force;
        switch (mode)
        {
            case ForceMode.Impulse:
                mode2D = ForceMode2D.Impulse;
                break;
            case ForceMode.Acceleration:
                forceApplied *= rb2d.mass;
                break;
            case ForceMode.VelocityChange:
                forceApplied = force * rb2d.mass / Time.fixedDeltaTime;
                break;
            case ForceMode.Force:
                //nothing special
                break;
        }

        if (relativeTo == Space.Self)
            rb2d.AddRelativeForce(forceApplied, mode2D);
        else if (relativeTo == Space.World)
            rb2d.AddForce(forceApplied, mode2D);
    }
开发者ID:Headgate2,项目名称:-mobile-games-pipeline,代码行数:32,代码来源:PhysicsExtensions.cs


示例15: Reset

 public override void Reset()
 {
     gameObject = null;
     speed = null;
     speedVector = null;
     space = Space.World;
 }
开发者ID:nothiphop,项目名称:PlayMakerCustomActions_U3,代码行数:7,代码来源:GetGameObjectSpeed.cs


示例16: Reset

 public override void Reset()
 {
     gameObjects = new FsmGameObject[1];
     storePositions = new FsmVector3[1];
     space = Space.World;
     everyFrame = false;
 }
开发者ID:ironicnet,项目名称:PlayMakerCustomActions_U3,代码行数:7,代码来源:GetPositionMultiple.cs


示例17: Awake

    void Awake()
    {
        InputHandler.OnZoom += this.Zoom;               // Subscribe to Zoom Event
        InputHandler.OnTouchMove += this.OnTouchMove;   // Subscribe to OnTouchMove Event

        var spaceGO = GameObject.Find("Space");
        if (spaceGO == null) {
            throw new MissingComponentException("Unable to find Space GameObject. This should be a global GO that contains the Space script.");
        }
        _map = spaceGO.GetComponent<Space>();
        if (_map == null) {
            throw new MissingComponentException("Unable to find space script. This component should be attached to the Space GameObject.");
        }

        _cameraWidthHalf = Camera.main.orthographicSize * Camera.main.aspect;
        _cameraHeightHalf = Camera.main.orthographicSize;

        _smallestPlanetDiameter = 25; // _map.GetSmallestDiameter();

        RecalculateCameraMinAndMaxSize();

        float cameraInitOrthoSize = Mathf.Max(_cameraMaxOrthoSize, _cameraMinOrthoSize) * 2 / 3; // max function is needed when the map returns a size of 0
        Camera.main.orthographicSize = cameraInitOrthoSize;
        _moveToPosition = _map.transform.position;

        _cameraOrthoSizeTo = Camera.main.orthographicSize; // needed? yes otherwise the first scroll is using zero as startpoint
        //_moveToPosition = FindHomePlanet();
    }
开发者ID:simonides,项目名称:space_concept,代码行数:28,代码来源:MapInput.cs


示例18: SetX

 public static void SetX(this Transform transform, float x, Space space = Space.Self)
 {
     if (space == Space.Self)
         transform.localPosition = transform.localPosition.ScaleBy(0, 1, 1) + x*Vector3.right;
     else
         transform.position = transform.position.ScaleBy(0, 1, 1) + x*Vector3.right;
 }
开发者ID:fatiguedartist,项目名称:Sisyphus,代码行数:7,代码来源:RDVectorExtensions.cs


示例19: Reset

 public override void Reset()
 {
     base.Reset();
     this.id = new FsmString
     {
         UseVariable = true
     };
     this.time = 1f;
     this.delay = 0f;
     this.loopType = iTween.LoopType.none;
     this.vector = new FsmVector3
     {
         UseVariable = true
     };
     this.speed = new FsmFloat
     {
         UseVariable = true
     };
     this.space = Space.World;
     this.orientToPath = false;
     this.lookAtObject = new FsmGameObject
     {
         UseVariable = true
     };
     this.lookAtVector = new FsmVector3
     {
         UseVariable = true
     };
     this.lookTime = 0f;
     this.axis = iTweenFsmAction.AxisRestriction.none;
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:31,代码来源:iTweenMoveBy.cs


示例20: OnAdditionToSpace

 /// <summary>
 /// Called after the object is added to a space.
 /// </summary>
 /// <param name="newSpace"></param>
 public override void OnAdditionToSpace(Space newSpace)
 {
     for (int i = 0; i < solverUpdateables.Count; i++)
     {
         solverUpdateables[i].OnAdditionToSpace(newSpace);
     }
 }
开发者ID:Raverenx,项目名称:GameEngine,代码行数:11,代码来源:SolverGroup.cs



注:本文中的Space类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Spaceship类代码示例发布时间:2022-05-24
下一篇:
C# SouthWind.NorthwindDB类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap