Beispiel #1
0
        public override void Loop()
        {
            timer -= Engine.DeltaTime;

            if (NeedsWater)
            {
                if (timer > timeToDieFromThirst * 0.3)
                {
                    renderer.foregroundColor = ConsoleColor.Gray;
                }
                else
                {
                    renderer.foregroundColor = ConsoleColor.DarkGray;
                }

                if (timer < 0)
                {
                    Dead = true;
                }
            }
            else
            {
                if (timer > timeToGrow * 0.3)
                {
                    renderer.foregroundColor = ConsoleColor.Cyan;
                }
                else
                {
                    renderer.foregroundColor = ConsoleColor.DarkCyan;
                }

                if (timer < 0)
                {
                    stage++;
                    NeedsWater = true;
                    timer      = timeToDieFromThirst;
                }
            }

            renderer.symbol = Symbol;

            if (stage >= 6)
            {
                NeedsWater = false;

                if (Produce)
                {
                    if (Produce.HeldBy || Produce.Position.Vector2Int != position.Vector2Int)
                    {
                        Engine.DestroyEntity(this.Entity);
                        Produce = null;
                    }
                }
                else
                {
                    LogBox.Log(kind + " is ready to harvest");
                    var ent = EntityFactory.CreateProduce(position.Vector2Int, kind);
                    Produce = ent.GetComponent <Produce>();
                }
            }

            if (Dead)
            {
                renderer.symbol          = 'x';
                renderer.foregroundColor = ConsoleColor.DarkYellow;
            }
        }
Beispiel #2
0
 public override void OnCreate()
 {
     base.OnCreate();
     LogBox.Log(kind + " was planted on " + position);
 }