IEnumerator C_ShootAttack()
    {
        print("I AM TRYING TO SHOOT");

        while (AI_Action == 1)
        {
            anim.SetBool("IsShooting", true);

            if (GameController.control.GuyLocation.transform.position.x > gameObject.transform.position.x && !facingRight)
            {
                Flip();
            }
            if (GameController.control.GuyLocation.transform.position.x < gameObject.transform.position.x && facingRight)
            {
                Flip();
            }

            //			gameObject.rigidbody2D.velocity = new Vector2(0, 0);

            if (ShootAtPlayer)
            {
                MonsterManipulation.ShootAtTarget_Player(0, ShotDelay, NumberOfShots, ShotSpeed);
            }
            else
            {
                if (gameObject.transform.position.x - ShotConstraint < GameController.control.GuyLocation.transform.position.x && GameController.control.GuyLocation.transform.position.x < gameObject.transform.position.x + ShotConstraint)
                {
                    if (gameObject.transform.position.y < GameController.control.GuyLocation.transform.position.y)
                    {
                        MonsterManipulation.ShootDirection(0, NumberOfShots, new Vector2(0, 1), ShotDelay, ShotSpeed);
                    }
                    else
                    {
                        MonsterManipulation.ShootDirection(0, NumberOfShots, new Vector2(0, -1), ShotDelay, ShotSpeed);
                    }
                }
                else
                if (gameObject.transform.position.y - ShotConstraint < GameController.control.GuyLocation.transform.position.y && GameController.control.GuyLocation.transform.position.y < gameObject.transform.position.y + ShotConstraint)
                {
                    if (facingRight)
                    {
                        MonsterManipulation.ShootDirection(0, NumberOfShots, new Vector2(1, 0), ShotDelay, ShotSpeed);
                    }
                    else
                    {
                        MonsterManipulation.ShootDirection(0, NumberOfShots, new Vector2(-1, 0), ShotDelay, ShotSpeed);
                    }
                }
            }

            yield return(new WaitForSeconds(ShotDelay * NumberOfShots));

            anim.SetBool("IsShooting", false);
            yield return(new WaitForSeconds(ReloadDelay));
        }

        print("I AM DONE TRYING TO SHOOT");
        anim.SetBool("IsShooting", false);
    }
Beispiel #2
0
    IEnumerator C_StartCoroutine()
    {
        yield return(new WaitForSeconds(StartDelay));

//		if (NumberOfSets == 0)
//			NumberOfSets = 1000;

        int I = 0;

//		for(int I=0; I<NumberOfSets; I++)
        while (I < NumberOfSets || NumberOfSets == 0)
        {
            if (ShootDirection)
            {
                SuperScript.ShootDirection(0, ObjectAmount, Target, ObjectDelay, ObjectSpeed);
            }
            if (ShootAtPlayer)
            {
                SuperScript.ShootAtTarget_Player(0, ObjectDelay, ObjectAmount, ObjectSpeed);
            }
            if (WaveyLine)
            {
                if (Xdirection != 0)
                {
                    SuperScript.WaveSpray_Horizontal(0, ObjectAmount, ObjectDelay, Amplitude_Y, PeriodSpeed_Y, ObjectSpeed);
                }
                if (Ydirection != 0)
                {
                    SuperScript.WaveSpray_Vertical(0, ObjectAmount, ObjectDelay, Amplitude_X, PeriodSpeed_X, ObjectSpeed);
                }
            }

            if (SprayInDirection)
            {
                SuperScript.SprayInDirection(0, ObjectAmount, Target, ObjectDelay, ObjectSpeed);
            }
            if (RandomSprayOutwards)
            {
                SuperScript.RandomSprayOutwards(0, ObjectDelay, ObjectAmount, ObjectSpeed);
            }

            // Next 3 count as one object
            if (CircleBurst)
            {
                SuperScript.CircleBurst(0, ObjectAmount, ObjectSpeed);
            }
            if (RandomRain)
            {
                SuperScript.ShootFromTopScreen(0, ObjectAmount, ObjectDelay, ObjectSpeed);
            }
            if (FollowTarget)
            {
                SuperScript.FollowTarget_Player(0, DeathTimer, ObjectSpeed);
            }
            if (RandomSprayBounce)
            {
                SuperScript.RandomSprayBounce(0, ObjectDelay, ObjectAmount, ObjectSpeed);
            }


            yield return(new WaitForSeconds(TimeToSpawnObjects));

            yield return(new WaitForSeconds(DelayBetweenSets));

            I++;
        }

        print(" I AM DONE");
        yield return(null);
    }