Ejemplo n.º 1
0
        public void Update()
        {
            energy -= 50;
            lifeTime++;
            if (mating)
            {
                energy -= 100;
            }
            if (!keyboardCreature)
            {
                isAlive &= (energy > 0 && lifeTime <= CREATURE_MAX_LIFESPAN);
            }
            UpdateMovement();
            rectangle = new RectangleF((float)position.x, (float)position.y, 1.5f * (float)size / 100, 1.5f * (float)ASPECT_RATIO * (float)size / 100);

            if (lifeTime - lastMatedAtTick > MATING_CYCLE_LENGTH)
            {
                readyToMate = true;
            }
            else
            {
                readyToMate = false;
            }

            if (mating)
            {
                actionColor = new double[] { 1, 0, 0 }
            }
            ;
            else
            {
                actionColor = new double[] { 0, 0, 0 }
            };

            agent.Activate(GetSensory());
            if (!keyboardCreature)
            {
                Act(agent.GetOutputs());
            }
        }