Example #1
0
    private void FixedUpdate()
    {
        if (Manager.isPlayerControlled && Manager.GameManager.NetworkManager.isClient)
        {
            var Input = Manager.GetInputInfo();
            Manager.GameManager.WriteInInputBuffer(new TimeInput(Input));
            Manager.GameManager.NetworkManager.Client.SendInputdata(Input);
        }

        if (updateRequired)
        {
            if ((newPosition - MainRigidbody.transform.position).magnitude > 0.15)
            {
                MainRigidbody.MovePosition(newPosition);
            }
            MainRigidbody.MoveRotation(newRotation);
            //   MainRigidbody.velocity = newVelocity;
            updateRequired = false;
        }

        // Move and turn the tank.
        Move();
        Turn();

        deltaTime = Time.deltaTime;
    }
Example #2
0
    public TankData(TankManager TankManager)
    {
        var TankInstance = TankManager.Instance;
        var movement     = TankInstance.GetComponent <TankMovement>();
        var health       = TankInstance.GetComponent <TankHealth>();
        var shooting     = TankInstance.GetComponent <TankShooting>();

        Inputs = TankManager.GetInputInfo();

        Position = TankInstance.transform.position;
        Forward  = TankInstance.transform.forward;
        Rotation = TankInstance.transform.rotation;
        Velocity = TankInstance.GetComponent <Rigidbody>().velocity;

        Health    = health.CurrentHealth;
        Dead      = health.Dead;
        Speed     = movement.Speed;
        TurnSpeed = movement.TurnSpeed;
        Wins      = TankManager.Wins;

        index = TankManager.Index;
    }