예제 #1
0
    public override void Update()
    {
        base.Update();

        if (!LevelController.Singleton.Paused)
        {
            time += Time.deltaTime;
            while (warningList.Count > 0 && time >= warningList[0].Data.Time)
            {
                Wave.SpawnWarning(warningList[0]);
                warningList.RemoveAt(0);
            }
            while (fireList.Count > 0 && time >= fireList[0].Time)
            {
                for (int i = 0; i < 360; i += 5)
                {
                    for (int j = 0; j < 10; j++)
                    {
                        fireData.From(new Vector2(fireList[0].Location.x + Mathf.Cos((i + j) * Mathf.Deg2Rad) * (30 + j),
                                                  fireList[0].Location.y + Mathf.Sin((i + j) * Mathf.Deg2Rad) * (30 + j)));
                        fireData.Towards(new Vector2(fireList[0].Location.x + Mathf.Cos((i + j + 90) * Mathf.Deg2Rad) * fireRadius,
                                                     fireList[0].Location.y + Mathf.Sin((i + j + 90) * Mathf.Deg2Rad) * fireRadius));
                        fireData.Fire();
                    }
                }
                fireList.RemoveAt(0);
                if (fireList.Count == 0)
                {
                    Destroy(gameObject, 5);
                }
            }
        }
    }
예제 #2
0
 public override void Start()
 {
     fireData = new FireBuilder(bulletPrefab, Field);
     fireData.From(transform);
     fireData.Towards(Player.transform);
     fireData.WithSpeed(3 + 3 * Difficulty);
 }
예제 #3
0
    private IEnumerator Attack()
    {
        while (true)
        {
            Vector3 position;
            int     direction;
            for (int i = 0; i < 3; i++)
            {
                position  = Player.transform.position;
                direction = Random.Range(0, 2) * 2 - 1;
                for (int j = 0; j < 16; j++)
                {
                    fireDataBullet.Towards(position);
                    fireDataBullet.WithRotation((12f * Mathf.Sqrt((16 - j) * 24) - 80) * direction);
                    fireDataBullet.Fire();
                    yield return(new WaitForSeconds(0.08f));
                }
                yield return(new WaitForSeconds(0.5f));
            }

            for (int i = 0; i < (enraged ? 5 : 3); i++)
            {
                still          = true;
                FacePlayer     = false;
                TargetRotation = transform.rotation;
                fireDataLaser.Fire();
                yield return(new WaitForSeconds(0.25f));

                still      = false;
                FacePlayer = true;
                yield return(new WaitForSeconds((enraged ? 0.25f : 0.5f)));
            }
        }
    }
예제 #4
0
    protected override IEnumerator Run()
    {
        for (int i = 0; i < 4; i++)
        {
            // Moving left
            FacePlayer           = true;
            rigidbody2d.velocity = new Vector2(-5, 0);
            yield return(new WaitForSeconds(2));

            // Stop and face player
            rigidbody2d.velocity = Vector2.zero;
            fireData.Towards(Player.transform.position);
            FacePlayer = false;

            // Fire
            yield return(new WaitForSeconds(0.2f));

            for (int j = 0; j < 10; j++)
            {
                fireData.Fire();
                yield return(new WaitForSeconds(0.2f));
            }
        }
        Die();
    }
예제 #5
0
 public override void Start()
 {
     fireData = new FireBuilder(bulletPrefab, Field);
     fireData.From(transform);
     fireData.Towards(Player.transform);
     fireData.WithSpeed(6);
     fireData.WithModifier(new CircularBurstModifier(100, 5, 0, 0));
 }
예제 #6
0
 public override void Start()
 {
     fireData = new FireBuilder(bulletPrefab, Field);
     fireData.From(transform);
     fireData.Towards(Player.transform);
     fireData.WithSpeed(6 + 2 * Difficulty);
     fireData.WithModifier(new RandomizeAngleModifier(360));
 }
예제 #7
0
    public override void Start()
    {
        direction = transform.position.x < 0 ? 1 : -1;
        transform.Rotate(Vector3.forward * -90 * direction);

        fireData = new FireBuilder(bulletPrefab, Field);
        fireData.From(transform);
        fireData.Towards(new Vector2(0, transform.position.y));
        fireData.WithSpeed(3);
        fireData.WithRotation(-30, 30);

        rigidbody2d          = GetComponent <Rigidbody2D>();
        rigidbody2d.velocity = new Vector2(direction * 4, 0);
    }
예제 #8
0
    protected override IEnumerator Run()
    {
        do
        {
            // Down Left
            FacePlayer           = true;
            rigidbody2d.velocity = new Vector2(4 + start, 4 + start);
            start = 0;
            yield return(new WaitForSeconds(2));

            // Stop and face player
            rigidbody2d.velocity = Vector2.zero;
            fireData.Towards(Player.transform.position);
            FacePlayer = false;

            // Fire
            yield return(new WaitForSeconds(0.2f));

            for (int j = 0; j < 3; j++)
            {
                fireData.Fire();
                yield return(new WaitForSeconds(0.2f));
            }

            //Up Left
            FacePlayer           = true;
            rigidbody2d.velocity = new Vector2(4, -4);
            yield return(new WaitForSeconds(2));

            // Stop and face player
            rigidbody2d.velocity = Vector2.zero;
            fireData.Towards(Player.transform.position);
            FacePlayer = false;

            // Fire
            yield return(new WaitForSeconds(0.2f));

            for (int j = 0; j < 3; j++)
            {
                fireData.Fire();
                yield return(new WaitForSeconds(0.2f));
            }

            //Up Right
            FacePlayer           = true;
            rigidbody2d.velocity = new Vector2(-4, -4);
            yield return(new WaitForSeconds(2));

            // Stop and face player
            rigidbody2d.velocity = Vector2.zero;
            fireData.Towards(Player.transform.position);
            FacePlayer = false;

            // Fire
            yield return(new WaitForSeconds(0.2f));

            for (int j = 0; j < 3; j++)
            {
                fireData.Fire();
                yield return(new WaitForSeconds(0.2f));
            }

            //Down Right
            FacePlayer           = true;
            rigidbody2d.velocity = new Vector2(-4, 4);
            yield return(new WaitForSeconds(2));

            // Stop and face player
            rigidbody2d.velocity = Vector2.zero;
            fireData.Towards(Player.transform.position);
            FacePlayer = false;

            // Fire
            yield return(new WaitForSeconds(0.2f));

            for (int j = 0; j < 3; j++)
            {
                fireData.Fire();
                yield return(new WaitForSeconds(0.2f));
            }
        } while (alive);
        Die();
    }