Ejemplo n.º 1
0
        private void OnPlayerTurnEnd(PlayerTurn sender, EventArgs e)
        {
            Console.WriteLine(sender.Player.Name + " ended turn.");

            PlayerTurnEnd?.Invoke(sender, e);

            if (++_currentPlayerTurnIndex == _players.Count)
            {
                End();
            }
            else
            {
                NewPlayerTurn();
            }
        }
Ejemplo n.º 2
0
    public IEnumerator Attack(Vector2Int pos)
    {
        PlayerTurnEnd?.Invoke();
        myAnim.SetBool("Shoot", true);
        yield return(new WaitForSecondsRealtime(time));

        myAnim.SetBool("Shoot", false);
        var tmp = Instantiate(plate, (Vector3Int)(currentPos + pos), Quaternion.identity).GetComponent <vinyl>();

        tmp.dir        = pos;
        tmp.MM         = MM;
        tmp.time       = time;
        PlayerTurnEnd += tmp.MoveVinyl;
        MM.pros.Add(tmp);
    }
Ejemplo n.º 3
0
    public IEnumerator MoveToPosition(Vector2 position, float timeToMove)
    {
        PlayerTurnEnd?.Invoke();
        StartCoroutine(MoveToPositionCam((Vector3Int)currentPos, timeToMove, Camera.main.transform));
        yield return(new WaitUntil(() => movementEnded));

        movementEnded = false;
        myAnim.SetBool("Move", true);
        yield return(new WaitForSecondsRealtime(timeToMove / 2));

        transform.position += (Vector3)(position / 2);
        yield return(new WaitForSecondsRealtime(timeToMove / 2));

        transform.position += (Vector3)(position / 2);
        movementEnded       = true;
    }
Ejemplo n.º 4
0
 public void EndPlayerTurn()
 {
     PlayerTurnEnd?.Invoke();
 }