Example #1
0
    public void shoot()
    {
        if (Input.GetButton("FirstWeapon"))
        {
            Vector3 mousePosition      = Camera.main.ScreenPointToRay(Input.mousePosition).origin;
            Vector3 playerPosition     = gameObject.transform.position;
            Vector3 calculatedPosition = new Vector3(mousePosition.x - playerPosition.x, mousePosition.y - playerPosition.y, playerPosition.z);
            Vector3 finalPosition;
            if (needRecadrageShoot(playerManager.getSwapPosition(), calculatedPosition))
            {
                finalPosition = recadrageShoot(playerManager.getSwapPosition(), calculatedPosition);
            }
            else
            {
                finalPosition = miseAuPointShoot(playerManager.getSwapPosition(), calculatedPosition);
            }

            arms [0].GetComponent <Animator> ().SetTrigger("Firing");
            arms [1].GetComponent <Animator> ().SetTrigger("Firing");
            playerManager.camera.shakeAmount = 0.05f;
            playerManager.camera.setShake(0.01f);
            weaponManager.directionAttack = finalPosition;
            weaponManager.AttackWithSpecialPosition(GameObject.Find("WeaponCanonMorue").transform.position);
        }
    }