Esempio n. 1
0
        public override void MoveTo(Vector3 destiny, float facingAngle)
        {
            //esto se hace tambien en server, pero deberia ser mejor si ACDTranslateNormalMessage tuviera un field q sea
            //initPosition ademas de destiny.
            Vector3 newStartPointOutSide = (this.Position + (destiny - this.Position).NormalizedCopy * 2f) + Vector3.UnitY; //esta suma le da altura, pa q no salga del piso
            Vector3 newPosition_y_up     = new Vector3(this.Position.x, newStartPointOutSide.y, this.Position.z);

            destiny = new Vector3(destiny.x, newStartPointOutSide.y, destiny.z); //dest es igual de alto que start, sino sale torcido.

            /*this.RigidBody = BulletPhysics.BasicDemo.Instance.LocalCreateRigidBody(0.0000000000001f, newStartPointOutSide, Projectile.ProjectileCollisionShape);
             * this.RigidBody.Gravity = BulletSharp.Vector3.Zero;
             * this.RigidBody.LinearVelocity = (newStartPointOutSide - newPosition_y_up).NormalizedCopy.ToBulletV3() * 100;
             * this.RigidBody.UserObject = this;
             *
             * BulletPhysics.BasicDemo.Instance.AddRigidBodyToWorldConcurrent(this.RigidBody);*/

            this.LinearTrajectorie = new LinearTrajectorie(this.Position, destiny);

            //Managers.MovementManager.MoveTo(this, this.Position, destiny, this.Speed);

            var movementMessage = new ACDTranslateNormalMessage
            {
                ActorId  = (int)this.DynamicID,
                Position = destiny,

                Angle = facingAngle,
                //lookAt = destiny,
                TurnImmediately = false,
                Speed           = this.TranslateSpeed, //deberia ser translate speed
                Field5          = 0,
            };

            this.World.BroadcastIfRevealed(movementMessage, this);
        }
Esempio n. 2
0
        private void updateMovement(TimeSpan elapsed)
        {
            if (!this.IsMoving)
            {
                return;
            }

            if (this.Path == null)
            {
                return;
            }


            Vector3 new_p = this.Path.Advance(elapsed.Ticks, this.TranslateSpeed);


            if (this.Path.IsFirstTrajectorieCallOnceTrick)
            {
                //ojo esto de abajo nose si va.
                ACDTranslateNormalMessage movementMessage = new ACDTranslateNormalMessage
                {
                    ActorId  = (int)this.DynamicID,
                    Position = this.Path.CurrentLinearTrajectorie.Destination,
                    Angle    = 0,
                    //lookAt = this.Path.CurrentLinearTrajectorie.Destination,
                    TurnImmediately = false,
                    Speed           = this.TranslateSpeed, //deberia ser translate speed
                    Field5          = 0,
                };

                this.World.BroadcastIfRevealed(movementMessage, this);
            }
            else
            {
                if (this.Path.HasChangeDirectionInLastStep)
                {
                    ACDTranslateNormalMessage movementMessage = new ACDTranslateNormalMessage
                    {
                        ActorId  = (int)this.DynamicID,
                        Position = this.Path.CurrentLinearTrajectorie.Destination,
                        Angle    = 0,
                        //lookAt = this.Path.CurrentLinearTrajectorie.Destination,
                        TurnImmediately = false,
                        Speed           = this.TranslateSpeed, //deberia ser translate speed
                        Field5          = 0,
                    };

                    this.World.BroadcastIfRevealed(movementMessage, this);
                    //a partir del primer step entra aca
                    //this.RotateTo(Path.CurrDirection);
                }
            }

            this.Position = new_p;

            if (Path.HasReachedPosition)
            {
                this.StopMoving();
            }
        }
Esempio n. 3
0
        public virtual void MoveTo(Vector3 point, float facingAngle)
        {
            //remember to use it with detourcrownd instead of manually moving it!

            /*this.InitialPositionMovement = this.Position.ToPxVector3();
             * this.DestinyPositionMovement = point.ToPxVector3();
             *
             * PhysXEngine.PhysXConcurrentActions.Enqueue(() =>
             *  {
             *      Managers.MovementManager.ActorsMoving.TryAdd(this.DynamicID, this);
             *      PxVector3 PathVectorToVelocity = this.PathVector;
             *      PathVectorToVelocity.Normalize();
             *      this.PxActor.LinearVelocity = PathVectorToVelocity * this.Speed;
             *  });*/


            //this.Position = point;  // TODO: will need update Position over time, not instantly.
            //this.SetFacingRotation(facingAngle);

            var movementMessage = new ACDTranslateNormalMessage
            {
                ActorId  = (int)this.DynamicID,
                Position = point,

                Angle = facingAngle,
                //lookAt = point,
                TurnImmediately = false,
                Speed           = this.WalkSpeed,
                Field5          = 0,
            };

            this.World.BroadcastIfRevealed(movementMessage, this);
        }
Esempio n. 4
0
        public void LookAt(Vector3 lookat_position)
        {
            //ojo esto de abajo nose si va.
            ACDTranslateNormalMessage movementMessage = new ACDTranslateNormalMessage
            {
                ActorId  = (int)this.DynamicID,
                Position = this.Position,
                Angle    = 0,
                //lookAt = lookat_position,
                TurnImmediately = false,
                Speed           = this.TranslateSpeed, //deberia ser translate speed
                Field5          = 0,
            };

            this.World.BroadcastIfRevealed(movementMessage, this);
        }
Esempio n. 5
0
        public void Move(Vector3D destination, float speed, ACDTranslateNormalMessage baseMessage = null)
        {
            _SetupMove(destination, speed);
            _moveCommand = MoveCommandType.Normal;

            if (baseMessage == null)
            {
                baseMessage = new ACDTranslateNormalMessage();
            }

            baseMessage.ActorId  = (int)this.Target.DynamicID;
            baseMessage.Position = destination;
            baseMessage.Angle    = (float)Math.Acos(this.Target.RotationW) * 2f;
            baseMessage.Speed    = speed;

            this.Target.World.BroadcastIfRevealed(baseMessage, this.Target);
        }
Esempio n. 6
0
        public void Move(Vector3D point, float facingAngle)
        {
            this.SetFacingRotation(facingAngle);

            var movementMessage = new ACDTranslateNormalMessage
            {
                ActorId         = (int)this.DynamicID,
                Position        = point,
                Angle           = facingAngle,
                TurnImmediately = false,
                Speed           = this.WalkSpeed,
                Field5          = 0,
                AnimationTag    = this.AnimationSet == null ? 0 : this.AnimationSet.GetAnimationTag(Mooege.Common.MPQ.FileFormats.AnimationTags.Walk)
            };

            this.World.BroadcastIfRevealed(movementMessage, this);
        }
Esempio n. 7
0
        public void Move(Vector3D point, float facingAngle)
        {
            this.Position = point;  // TODO: will need update Position over time, not instantly.
            this.SetFacingRotation(facingAngle);

            // find suitable movement animation
            int aniTag;

            if (this.AnimationSet == null)
            {
                aniTag = -1;
            }
            else if (this.AnimationSet.TagExists(Mooege.Common.MPQ.FileFormats.AnimationTags.Walk))
            {
                aniTag = this.AnimationSet.GetAnimationTag(Mooege.Common.MPQ.FileFormats.AnimationTags.Walk);
            }
            else if (this.AnimationSet.TagExists(Mooege.Common.MPQ.FileFormats.AnimationTags.Run))
            {
                aniTag = this.AnimationSet.GetAnimationTag(Mooege.Common.MPQ.FileFormats.AnimationTags.Run);
            }
            else
            {
                aniTag = -1;
            }

            var movementMessage = new ACDTranslateNormalMessage
            {
                ActorId         = (int)this.DynamicID,
                Position        = point,
                Angle           = facingAngle,
                TurnImmediately = false,
                Speed           = this.WalkSpeed,
                Field5          = 0,
                AnimationTag    = aniTag
            };

            this.World.BroadcastIfRevealed(movementMessage, this);
        }