コード例 #1
0
        public void Simulate()
        {
            if (PositionChanged || RotationChanged)
            {
                if (PositionChanged)
                {
                    FuturePosition.x        = Position.x + Velocity.x * PhysicsManager.ColSpreadMul;
                    FuturePosition.y        = Position.y + Velocity.y * PhysicsManager.ColSpreadMul;
                    this.transform.position = Position.ToVector3(this.transform.position.y);
                }
                else
                {
                }

                if (RotationChanged)
                {
                    this.transform.rotation = Quaternion.LookRotation(new Vector3(FixedMath.ToFloat(Rotation.x), 0, FixedMath.ToFloat(Rotation.y)));
                }
                else
                {
                }

                BuildPoints();
                BuildBounds();

                PositionChanged = false;
                RotationChanged = false;
            }
            else
            {
            }
        }
コード例 #2
0
        void OnDrawGizmos()
        {
            if (!Application.isPlaying)
            {
                return;
            }
            Gizmos.color = Color.white;
            Vector3[] PolyLine;
            LSBody    body           = this;
            Vector3   TargetPosition = ((MonoBehaviour)body).transform.position;

            //TargetPosition.y += .55f;
            switch (body.Shape)
            {
            case ColliderType.Circle:
                LSEditorUtility.GizmoCircle(TargetPosition, FixedMath.ToFloat(body.Radius));
                break;

            case ColliderType.AABox:
                PolyLine = new Vector3[] {
                    TargetPosition,
                    TargetPosition,
                    TargetPosition,
                    TargetPosition
                };
                float halfWidth  = FixedMath.ToFloat(body.HalfWidth);
                float halfHeight = FixedMath.ToFloat(body.HalfHeight);
                PolyLine [0].x += halfWidth;
                PolyLine [0].z += halfHeight;
                PolyLine [1].x += halfWidth;
                PolyLine [1].z -= halfHeight;
                PolyLine [2].x -= halfWidth;
                PolyLine [2].z -= halfHeight;
                PolyLine [3].x -= halfWidth;
                PolyLine [3].z += halfHeight;
                LSEditorUtility.GizmoPolyLine(PolyLine);
                break;

            case ColliderType.Polygon:
                int VertLength = body.Vertices.Length;
                PolyLine = new Vector3[VertLength];
                for (int i = 0; i < VertLength; i++)
                {
                    PolyLine[i] = body.RealPoints[i].ToVector3(TargetPosition.y);
                }
                LSEditorUtility.GizmoPolyLine(PolyLine);
                break;
            }
        }
コード例 #3
0
        public static void Initialize()
        {
            Time.fixedDeltaTime = FixedMath.ToFloat(Timestep);
            FrameCount          = 0;
            LSUtility.Initialize(1);
            CoroutineManager.Initialize();

            NetworkManager.Initialize();
            FrameManager.Initialize();
            AgentController.Initialize(Instance.AgentObjects);
            PhysicsManager.Initialize();
            InputManager.Initialize();
            PlayerManager.Initialize();

            MovementGroup.Initialize();

            Initialized = true;
        }