コード例 #1
0
    public void Use(GameObject user)
    {
        Enemy_AI        aI           = GameObject.Find("Enemy").GetComponent <Enemy_AI>();
        CoolDownManager aiCDMaganger = GameObject.Find("Enemy").GetComponent <CoolDownManager>();
        Skill           ba           = new BasicAttack();

        if (user == GameObject.Find("Player") && !Skill_Handler.isBroken && skill_Handler.QSlot.cdEnd && skill_Handler.state == Skill_Handler.ButtonState.qActive)
        {
            playerShot = true;
            BulletDirection thisBullet = Instantiate(Bullet, firepoint.position, Quaternion.identity);
            thisBullet.gameObject.name = "PlayerBullet";

            skill_Handler.QSlot.CoolDownCounter(CreatePlayer.chosenShip.QSkill, skill_Handler.qSkillSlot);
        }

        if (user == GameObject.Find("Enemy") && !aI.isBroken && cdEnd)
        {
            BulletDirection thisBullet = (BulletDirection)Instantiate(Bullet, firepoint.position, Quaternion.identity);
            thisBullet.transform.rotation = Quaternion.Euler(0, 180f, 0);
            thisBullet.gameObject.name    = "EnemyBullet";
            thisBullet.EnemyShot();

            if (Circle_Move_Behaviour.enemyCircleMove)
            {
                ba.SkillCoolDown = 1;
            }

            StartCoroutine(SimpleCoolDown(CreateEnemy.EnemyShip.QSkill.SkillCoolDown));
        }
    }
コード例 #2
0
    private IEnumerator ShootSecond(float t, GameObject user)
    {
        yield return(new WaitForSecondsRealtime(t));

        BulletDirection Bullet2 = Instantiate(thisBullet, transform.position, Quaternion.identity);

        if (user == Enemy)
        {
            Bullet2.EnemyShot();
        }
    }
コード例 #3
0
 private void Shoot()
 {
     if (state == State.shooting)
     {
         if (!playerShot)
         {
             BulletDirection Bullet1    = Instantiate(thisBullet, transform.position, Quaternion.Euler(0, 180, 0));
             Missile         newMissile = Instantiate(thisMissile, this.transform.position, Quaternion.Euler(0, 180, 0));
             Bullet1.EnemyShot();
             StartCoroutine(ShootSecond(1, Enemy));
             newMissile.EnemyShot();
             StartCoroutine(newMissile.GetOutState(Player));
         }
         else
         {
             BulletDirection newBullet  = Instantiate(thisBullet, transform.position, Quaternion.identity);
             Missile         newMissile = Instantiate(thisMissile, this.transform.position, Quaternion.identity);
             StartCoroutine(ShootSecond(1, Player));
             StartCoroutine(newMissile.GetOutState(Enemy));
         }
         state = State.wait;
     }
 }