Пример #1
0
        public RemotePlayer(Vector3 pos, NetworkGamer associatedGamer) :
            base(Global.game, pos, Vector3.Zero, Global.Constants.PLAYER_RADIUS)
        {
            score = 0;
            Texture2D blankTex = Global.game.Content.Load <Texture2D>(@"Textures\blankTexture");

            sphere            = new Sphere(Global.game, Global.Constants.DEFAULT_PLAYER_COLOR, pos);
            cube              = new Cube(blankTex, Color.Gray);
            sphere.localScale = Matrix.CreateScale(5);
            sphere.SetWireframe(1);
            cube.wireFrame     = false;
            cube.textured      = false;
            cubeTransformation = Matrix.CreateScale(1, 1, gunLength) * Matrix.CreateTranslation(new Vector3(radius, 0, gunLength));
            isJuggernaut       = false;
            yaw   = 0;
            pitch = 0;

            simulationState          = new RemotePlayerState();
            simulationState.position = position;
            simulationState.velocity = velocity;
            simulationState.pitch    = pitch;
            simulationState.yaw      = yaw;
            previousState            = new RemotePlayerState();
            previousState.position   = position;
            previousState.velocity   = velocity;
            previousState.pitch      = pitch;
            previousState.yaw        = yaw;
            currentSmoothing         = 1;
        }
Пример #2
0
 public void Lock(Transform target)
 {
     _target = target;
     _state  = RemotePlayerState.Lock;
     PlayerAnimation.IsGrounded = true;
     PlayerAnimation.VelocityX  = 0;
     PlayerAnimation.VelocityZ  = 0;
 }
Пример #3
0
 public void Patrol(Vector3 position)
 {
     _target   = null;
     _position = position;
     _state    = RemotePlayerState.Patrol;
     AimPoint.parent.rotation   = transform.rotation;
     PlayerAnimation.IsGrounded = true;
     PlayerAnimation.VelocityX  = 0;
     PlayerAnimation.VelocityZ  = 4;
 }
Пример #4
0
 public void Setup(IMessageBroker message, Vector3 position, Quaternion rotation)
 {
     message.Receive <MsgData>().Subscribe(x =>
     {
         if (GameConst.MsgDie == x.Type)
         {
             DieSound.PlayDelayed(0.2f);
             transform.localPosition += Vector3.up * 0.03f;
             enabled = false;
         }
     }).AddTo(this);
     for (int i = 0; i < PlayerWeapons.Length; i++)
     {
         PlayerWeapons[i].Setup(message);
     }
     PlayerAnimation.Message = message;
     _position = position;
     _rotation = rotation;
     _state    = RemotePlayerState.Sync;
 }