Example #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
            });
        }
Example #2
0
 public TileUpdateResult?Update(TileUpdateApi api) => null;