Ejemplo n.º 1
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;
     }
 }
Ejemplo n.º 2
0
    public void Use(GameObject user)
    {
        Enemy_AI aI = GameObject.Find("Enemy").GetComponent <Enemy_AI>();

        if (user == GameObject.Find("Player") && !Skill_Handler.isBroken && skill_Handler.WSlot.cdEnd && skill_Handler.state == Skill_Handler.ButtonState.wActive)
        {
            Missile newMissile = (Missile)Instantiate(MissilePrefab, firepoint.position, Quaternion.identity);
            newMissile.gameObject.name = "PlayerMissile";
            StartCoroutine(newMissile.GetOutState(Enemy));

            skill_Handler.WSlot.CoolDownCounter(CreatePlayer.chosenShip.WSkill, skill_Handler.wSkillSlot);
        }
        if (user == GameObject.Find("Enemy") && !aI.isBroken && cdEnd)
        {
            Skill   sm          = new SteeringMissile();
            Missile thisMissile = (Missile)Instantiate(MissilePrefab, MissilePoint.position, Quaternion.identity);
            thisMissile.gameObject.name    = "EnemyMissile";
            thisMissile.transform.rotation = Quaternion.Euler(0, 180f, 0);
            thisMissile.EnemyShot();
            StartCoroutine(thisMissile.GetOutState(GameObject.Find("Player")));
            StartCoroutine(SimpleCoolDown(CreateEnemy.EnemyShip.WSkill.SkillCoolDown));
        }
    }