Ejemplo n.º 1
0
        public void Initialize(Vector3d StartPosition, Vector2d StartRotation, bool isDynamic = true)
        {
            Active = true;
            PositionalTransform = _positionalTransform;
            RotationalTransform = _rotationalTransform;
            if (!Setted)
            {
                this.Setup(null);
            }
            this.RaycastVersion = 0;

            this.HeightPosChanged = true;

            CheckVariables();

            PositionChanged       = true;
            RotationChanged       = true;
            VelocityChanged       = true;
            PositionChangedBuffer = true;
            RotationChangedBuffer = true;

            Priority          = BasePriority;
            Velocity          = Vector2d.zero;
            VelocityMagnitude = 0;
            LastPosition      = _position = StartPosition.ToVector2d();
            _heightPos        = StartPosition.z;
            _rotation         = StartRotation;
            ForwardNeedsSet   = true;
            FastRadius        = this.Radius * this.Radius;

            XMin = 0;
            XMax = 0;
            YMin = 0;
            YMax = 0;


            PastGridXMin = int.MaxValue;
            PastGridXMax = int.MaxValue;
            PastGridYMin = int.MaxValue;
            PastGridYMax = int.MaxValue;

            if (Shape != ColliderType.None)
            {
                BuildPoints();
                BuildBounds();
            }

            ID = PhysicsManager.Assimilate(this, isDynamic);
            Partition.PartitionObject(this);
            if (PositionalTransform != null)
            {
                CanSetVisualPosition         = true;
                _visualPosition              = _position.ToVector3(HeightPos.ToFloat());
                lastVisualPos                = _visualPosition;
                PositionalTransform.position = _visualPosition;
            }
            else
            {
                CanSetVisualPosition = false;
            }
            if (RotationalTransform != null)
            {
                CanSetVisualRotation = true;
                visualRot            = GetVisualRot();
                //				_rotationOffset = transform.GetComponent<InvasionDay.GeoHandler>()._eulerOffset;
                lastVisualRot = visualRot;
            }
            else
            {
                CanSetVisualRotation = false;
            }
            SetVisuals();
            velocityPosition = Vector3.zero;
            this.ImmovableCollisionDirection = Vector2d.zero;
            PartitionChanged = true;
        }
Ejemplo n.º 2
0
 public static void Deactivate()
 {
     Partition.Deactivate();
 }
Ejemplo n.º 3
0
 public static void Setup()
 {
     SimObjects = new LSBody[MaxSimObjects];
     Partition.Setup();
 }
Ejemplo n.º 4
0
 public static void Simulate()
 {
     Partition.CheckAndDistributeCollisions();
     Simulated = true;
 }
Ejemplo n.º 5
0
 public static void Setup()
 {
     Partition.Setup();
 }