示例#1
0
    void Update()
    {
        if (instance == null)
        {
            GameModeManagerBase.SetManagerInstance(ref instance);
        }

        if (instance.mState == GameModeManagerBase.State.Paused)
        {
            return;
        }

        string fireButton = "";

        if (player.name == "Player 1")
        {
            fireButton = "Fire1";
        }

        if (player.name == "Player 2")
        {
            fireButton = "Fire2";
        }

        if (Input.GetButton(fireButton) && Time.time > nextFire)
        {
            nextFire = Time.time + fireRate;
            GameObject clone = instance.GetBulletSpawner()
                               .Spawn(shotSpawn.position, shotSpawn.rotation, player);
            rb          = clone.GetComponent <Rigidbody>();
            rb.velocity = clone.transform.forward * bulletSpeed;
        }
    }
示例#2
0
    void FixedUpdate()
    {
        float horizontalInput = 0.0f;
        float forwardVelocity = 0.0f;

        if (instance == null)
        {
            GameModeManagerBase.SetManagerInstance(ref instance);
        }

        if (instance.mState == GameModeManagerBase.State.Paused)
        {
            return;
        }

        if (name == "Player 1")
        {
            horizontalInput = Input.GetAxis("Horizontal_p1");
            forwardVelocity = Input.GetAxisRaw("Vertical_p1");
        }

        if (name == "Player 2")
        {
            horizontalInput = Input.GetAxis("Horizontal_p2");
            forwardVelocity = Input.GetAxisRaw("Vertical_p2");
        }

        transform.RotateAround(transform.position, transform.up, horizontalInput * TurnSpeed);
        mBody.velocity += (transform.forward * Mathf.Clamp(forwardVelocity, 0.0f, 1.0f) * Speed);
        mBody.velocity  = new Vector3(
            Mathf.Clamp(mBody.velocity.x, -maxVelocity, maxVelocity),
            0.0f,
            Mathf.Clamp(mBody.velocity.z, -maxVelocity, maxVelocity));
    }
示例#3
0
    void FixedUpdate()
    {
        if (instance == null)
        {
            GameModeManagerBase.SetManagerInstance(ref instance);
        }

        if (instance.mState != GameModeManagerBase.State.Paused)
        {
            rb.MoveRotation(rb.rotation * deltaRotation);
        }
    }
示例#4
0
    void Update()
    {
        if (instance == null)
        {
            GameModeManagerBase.SetManagerInstance(ref instance);
            PlayerOne = instance.GetPlayerOne();
            PlayerTwo = instance.GetPlayerTwo();
        }

        if (instance.mState == GameModeManagerBase.State.Playing)
        {
            AimAndFire();
        }
    }
示例#5
0
    void Update()
    {
        if (instance == null)
        {
            GameModeManagerBase.SetManagerInstance(ref instance);
        }

        //Needs to be changed to the base class
        if (instance.mState == GameModeManagerBase.State.Paused)
        {
            return;
        }
        ApplyThrustEffect();
    }
示例#6
0
 void Awake()
 {
     GameModeManagerBase.SetManagerInstance(ref instance);
     player = transform.root.gameObject;
 }