示例#1
0
 public override void Update(MajorStateInput stateInput)
 {
     if (stateInput.enemyController.isAwake)
     {
         character.ChangeState <MajorIdleState>();
     }
 }
示例#2
0
    // bosses have a sleep state that gets switched to idle when the player triggers their associated area

    public override void Enter(MajorStateInput stateInput, CharacterStateTransitionInfo transitionInfo = null)
    {
        base.Enter(stateInput, transitionInfo);
        stateInput.anim.Play("major_sleep");
        stateInput.enemyController.EnemyPause(1f);
        stateInput.enemyController.isAwake = false;
    }
示例#3
0
 public override void Update(MajorStateInput stateInput)
 {
     stateInput.enemyController.TurnToFacePlayer(stateInput.player.transform.position);
     if (stateInput.enemyController.canAct)
     {
         character.ChangeState <MajorRunState>();
     }
 }
示例#4
0
 public override void Enter(MajorStateInput stateInput, CharacterStateTransitionInfo transitionInfo = null)
 {
     base.Enter(stateInput, transitionInfo);
     stateInput.anim.Play("major_run");
     if (stateInput.enemyController.facingRight)
     {
         stateInput.rb.velocity = new Vector2(stateInput.major_inconvenience.moveSpeed, 0);
     }
     else
     {
         stateInput.rb.velocity = new Vector2(-stateInput.major_inconvenience.moveSpeed, 0);
     }
 }
示例#5
0
    public override void Update(MajorStateInput stateInput)
    {
        Vector2      checkpoint1;
        RaycastHit2D hit1;

        if (!stateInput.enemyController.facingRight)
        {
            checkpoint1 = new Vector2(stateInput.collider.bounds.center.x - stateInput.collider.bounds.extents.x, stateInput.collider.bounds.center.y);
            hit1        = Physics2D.Raycast(checkpoint1, Vector2.left, 1f, 1 << 9);
            Debug.DrawRay(checkpoint1, Vector2.down, Color.blue, 1f);
        }
        else
        {
            checkpoint1 = new Vector2(stateInput.collider.bounds.center.x + stateInput.collider.bounds.extents.x, stateInput.collider.bounds.center.y);
            hit1        = Physics2D.Raycast(checkpoint1, Vector2.right, 1f, 1 << 9);
            Debug.DrawRay(checkpoint1, Vector2.down, Color.blue, 1f);
        }

        if (hit1)
        {
            stateInput.enemyController.StopMoving();
            character.ChangeState <MajorIdleState>();
        }
    }