예제 #1
0
 private void Awake()
 {
     // Auto Get Components
     mainGun     = new DuelGun(spawnPoint, bulletPrefab, bulletFolder);
     mainBody    = GetComponent <Rigidbody2D>();
     animControl = GetComponent <AnimationControl2D>();
 }
예제 #2
0
        private void InputGunFire(DuelGun gun, bool Try2Shoot)
        {
            if (Try2Shoot && readyToShoot)
            {
                gun.TryFireGun(ShootSound, failedShootSound, playerNumber); // Action

                if (animControl)
                {
                    animControl.ChangeState("Shoot");              // Animation
                }
                else
                {
                    print("NO ANIMATION CONTROL");
                }

                if (animControl) // Delay Next Shoot
                {
                    readyToShoot = false;
                    float delay = animControl.GetStateLenght();
                    Invoke("SetReadytoShoot", delay);
                }
                else
                {
                    print("NO DELAY - ANIMATION CONTROL MISSING");
                }
            }
        }