示例#1
0
 public override IEnumerator Act()
 {
     while (true)
     {
         if (Input.GetKeyDown(KeyCode.Space))
         {
             break;
         }
         if (Input.GetKeyDown(KeyCode.W))
         {
             if (mover.Move(Vector2.up))
             {
                 break;
             }
             else
             {
                 yield return(StartCoroutine(Attack(Vector2.up))); break;
             }
         }
         if (Input.GetKeyDown(KeyCode.S))
         {
             if (mover.Move(Vector2.down))
             {
                 break;
             }
             else
             {
                 yield return(StartCoroutine(Attack(Vector2.down))); break;
             }
         }
         if (Input.GetKeyDown(KeyCode.A))
         {
             if (mover.Move(Vector2.left))
             {
                 break;
             }
             else
             {
                 yield return(StartCoroutine(Attack(Vector2.left))); break;
             }
         }
         if (Input.GetKeyDown(KeyCode.D))
         {
             if (mover.Move(Vector2.right))
             {
                 break;
             }
             else
             {
                 yield return(StartCoroutine(Attack(Vector2.right))); break;
             }
         }
         yield return(null);
     }
     initiative += TurnManager.Instance.GetLastActorInitiative();
     yield return(null);
 }
示例#2
0
    public override IEnumerator Act()
    {
        if (GetComponent <Renderer>().isVisible)
        {
            yield return(new WaitForSeconds(0.25f));
        }

        while (true)
        {
            if (mover.Move(directions[currentDirection]))
            {
                yield return(null);

                break;
            }
            if (CanAttack(directions[currentDirection]))
            {
                yield return(StartCoroutine(Attack(directions[currentDirection])));

                break;
            }
            currentDirection++; currentDirection %= directions.Length;

            yield return(null);
        }

        if (GetComponent <Renderer>().isVisible)
        {
            yield return(new WaitForSeconds(0.25f));
        }
    }
示例#3
0
 public override IEnumerator Act()
 {
     mover.Move(0, 1);
     initiative = TurnManager.Instance.GetLastActorInitiative() + 1;
     yield return(new WaitForSeconds(0.2f));
 }