Ejemplo n.º 1
0
    private void PartyHard()
    {
        GameObject EnemyCircleDetector = transform.GetChild(0).gameObject;
        var        EnemyList           = Physics2D.OverlapCircleAll(transform.position, EnemyCircleDetector.GetComponent <CircleCollider2D>().radius, 1 << LayerMask.NameToLayer("Enemy"));

        if (EnemyList.Length > 0)
        {
            GameObject instantiatedEffect = Instantiate <GameObject> (effect);
            instantiatedEffect.transform.position = transform.position;

            for (int i = 0; i < EnemyList.Length * (1f - missRate); i++)
            {
                //If the enemy found in the list is not null start shooting at that
                if (EnemyList[i] != null)
                {
                    FollowPathEnemy enemy = EnemyList [i].GetComponent <FollowPathEnemy> ();
                    enemy.LoseHealth(bulletDamage, BulletTyper.Normal);
                    Timer = 0;
                }
            }
            SwitchStates = State.StartShooting;
        }
    }
Ejemplo n.º 2
0
    private void DeployFreezeRay()
    {
        GameObject EnemyCircleDetector = transform.GetChild(0).gameObject;
        var        EnemyList           = Physics2D.OverlapCircleAll(transform.position, EnemyCircleDetector.GetComponent <CircleCollider2D>().radius, 1 << LayerMask.NameToLayer("Enemy"));

        if (EnemyList.Length > 0)
        {
            for (int i = 0; i < EnemyList.Length; i++)
            {
                GameObject instantiatedEffect = Instantiate <GameObject> (effect);
                instantiatedEffect.transform.position = transform.position;

                //If the enemy found in the list is not null start shooting at that
                if (EnemyList[i] != null)
                {
                    FollowPathEnemy enemy = EnemyList [i].GetComponent <FollowPathEnemy> ();
                    enemy.startSlow();
                }
                Timer = 0;
            }
            SwitchStates = State.StartShooting;
        }
    }