Exemplo n.º 1
0
        public TileUpdateResult?Update(TileUpdateApi api)
        {
            Side?wantedMovement = null;
            bool?wantToGoStale  = null;

            if (!api.TileExistsAt(Side.South))
            {
                wantedMovement = Side.South;
            }
            else
            {
                var randomBool        = UnityEngine.Random.value > 0.5f;
                var randomCornerSide1 = randomBool ? Side.SouthWest : Side.SouthEast;
                var randomCornerSide2 = randomBool ? Side.SouthEast : Side.SouthWest;

                if (!api.TileExistsAt(randomCornerSide1))
                {
                    wantedMovement = randomCornerSide1;
                }
                else if (!api.TileExistsAt(randomCornerSide2))
                {
                    wantedMovement = randomCornerSide2;
                }
                else
                {
                    wantToGoStale = true;
                }
            }

            return(new TileUpdateResult
            {
                WantedMovement = wantedMovement,
                WantToGoStale = wantToGoStale
            });
        }
Exemplo n.º 2
0
 public TileUpdateResult?Update(TileUpdateApi api) => null;