Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (playerAvatar.fullReloading)
        {
            playerAvatar.ReloadEnergy(0.05f);
            return;
        }
        Vector3 pos = engine.Move(transform.position, inputController.Speed);

        if (Vector3.Distance(transform.position, pos) != 0)
        {
            playerAvatar.SpendEnergy(0.05f);
            transform.position = pos;
        }

        if (inputController.Fire)
        {
            Debug.Log("Fire");
            playerBulletGun.Fire();
            playerAvatar.SpendEnergy(0.05f);
            inputController.Fire = false;
        }
        else
        {
            playerAvatar.ReloadEnergy(0.1f);
        }
        if (inputController.SwitchGun)
        {
            playerBulletGun.Switch();
            inputController.SwitchGun = false;
        }
    }