Example #1
0
    private void Update()
    {
        if (HP < 70 && !SecondPhaseTrigger)
        {
            SecondPhaseTrigger = true;
            Task generate = _tasks.GetTask <GenerateEnemyTask>();
            generate.Status = Task.TaskStatus.Success;
            Task bullet = _tasks.GetTask <ShootBulletTask>();
            bullet.Status = Task.TaskStatus.Success;
            _tasks.Add(new GenerateEnemyTask(gameObject, 2, 1, 3));
            _tasks.Add(new ShootBulletTask(gameObject, false, 2));
        }

        if (HP < 30 && !ThirdPhaseTrigger)
        {
            ThirdPhaseTrigger = true;
            Task generate = _tasks.GetTask <GenerateEnemyTask>();
            generate.Status = Task.TaskStatus.Success;
            Task bullet = _tasks.GetTask <ShootBulletTask>();
            bullet.Status = Task.TaskStatus.Success;
            _tasks.Add(new GenerateEnemyTask(gameObject, 3, 2, 3));
            _tasks.Add(new ShootBulletTask(gameObject, true, 2));
        }

        if (!_tasks.HasTask <MoveTask>())
        {
            Add_MoveTask();
        }
        // If there's no more tasks queue up a new move sequence
        _tasks.TaskUpdate();
    }