示例#1
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");
                }
            }
        }
示例#2
0
        //Pick Bullet
        private void OnTriggerEnter2D(Collider2D collision)
        {
            BulletPickUp bullet = collision.GetComponent <BulletPickUp>();

            if (bullet)
            {
                bullet.PickUp();

                // Update Animation and State / Delay Movement
                animControl.ChangeState("Shoot");
                isShooting = true;
                Invoke("ResumeMovement", animControl.GetStateLenght());
            }

            EggPickUp egg = collision.GetComponent <EggPickUp>();

            if (egg)
            {
                egg.PickUp();
            }
        }