コード例 #1
0
            public void Update()
            {
                if (map[CalculateMapPosition(Position)] == entitiesByEnum[EntityEnum.Sand].Id)
                {
                    MarkAs(EntityEnum.WetSand, Position);
                }

                if (map[CalculateMapPosition(Position)] == entitiesByEnum[EntityEnum.Water].Id)
                {
                    Done  = true;
                    State = WaterlingState.Ghosted;
                }

                HandleState();

                var underlingsCopy = Underlings.ToList();

                foreach (var underling in underlingsCopy)
                {
                    underling.Update();
                }

                if (Underlings.Any(u => u.IsInfinite))
                {
                    IsInfinite = true;
                }

                if (State == WaterlingState.Idle && (Underlings.Count == 0 || Underlings.All(u => u.Done)))
                {
                    Done = true;
                }
            }
コード例 #2
0
 public void ChildUpdatedItsState(Waterling pChild, WaterlingState pState)
 {
     if (Underlings.All(u => u.State == WaterlingState.WalkedIntoAWall))
     {
         State = WaterlingState.FillAndClimb;
     }
 }