Ejemplo n.º 1
0
    /// <summary>
    /// Change state. Used force mode.
    /// </summary>
    /// <param name="newState"></param>
    /// <param name="actorID">0 is "general actor"; 1,2,3,4 - players</param>
    public void ChangeState(FieldSquareState newState, int actorID)
    {
        SquareState = newState;
        ActorID     = actorID;

        switch (newState)
        {
        case FieldSquareState.Empty:
            spriteRenderer.color = Color.white;
            break;

        case FieldSquareState.Fruit:
            spriteRenderer.color = Color.red;
            break;

        case FieldSquareState.BodyOfSnake:
        case FieldSquareState.HeadOfSnake:
            spriteRenderer.color = ColorByActorID.Get(actorID);
            break;

        default:
            spriteRenderer.color = Color.black;
            break;
        }
    }
Ejemplo n.º 2
0
 void Display()
 {
     for (var i = playersInRoom - 1; i >= 0; i--)
     {
         string prefix = ratingJournal[i].IsMine ? YouPrefix : OpponentPrefix;
         //Set text
         ratingBoard[i].text = $"{i+1}) {prefix}{ratingJournal[i].Score}";
         //Set color
         ratingBoard[i].color = ratingJournal[i].IsActive ? ColorByActorID.Get(ratingJournal[i].ActorID) : Color.gray;
     }
 }