Ejemplo n.º 1
0
    public void ShootBullet()
    {
        if (bulletShoot == null)
        {
            print("shot empty");
        }
        else if (keyB.GetButton("Up") && keyB.GetButton("Right"))
        {
            //UR means upper right direction
            bulletShoot.GetComponent <Player8Shoot>().bulletDirection = 8;
            ScriptBullet();
        }
        else if (keyB.GetButton("Up") && keyB.GetButton("Left"))
        {
            //UL means upper left direction
            bulletShoot.GetComponent <Player8Shoot>().bulletDirection = 7;
            ScriptBullet();
        }
        else if (keyB.GetButton("Up"))
        {
            bulletShoot.GetComponent <Player8Shoot>().bulletDirection = 6;
            ScriptBullet();
        }


        else if (keyB.GetButton("Down") && keyB.GetButton("Right"))
        {
            //DR means lower right direction
            bulletShoot.GetComponent <Player8Shoot>().bulletDirection = 5;
            ScriptBullet();
        }
        else if (keyB.GetButton("Down") && keyB.GetButton("Left"))
        {
            //DL means lower left direction
            bulletShoot.GetComponent <Player8Shoot>().bulletDirection = 4;
            ScriptBullet();
        }
        else if (keyB.GetButton("Down"))
        {
            bulletShoot.GetComponent <Player8Shoot>().bulletDirection = 3;
            ScriptBullet();
        }


        else if (facingRight)
        {
            bulletShoot.GetComponent <Player8Shoot>().bulletDirection = 2;
            ScriptBullet();
        }
        else if (facingRight == false)
        {
            bulletShoot.GetComponent <Player8Shoot>().bulletDirection = 1;
            ScriptBullet();
        }
    }
    // Update is called once per frame
    void FixedUpdate()
    {
        if (gameObject.GetComponent <CharacterSwapping>().currentCharacter.GetComponent <PlayerController>().controlEnabled)
        {
            gameObject.GetComponent <CharacterSwapping>().currentCharacter.GetComponent <PlayerAggro>().toUpdate();
        }

        if (keyBinds.GetButton("Right"))
        {
            characterSwapper.currentCharacter.GetComponent <PlayerController>().moveRight();
        }
        ;

        if (keyBinds.GetButton("Left"))
        {
            characterSwapper.currentCharacter.GetComponent <PlayerController>().moveLeft();
        }
        ;
    }