コード例 #1
0
        /// <summary>
        /// Update this instance.  Called once per frame.
        /// </summary>
        public void Update()
        {
            if (!this.IsActiveOnGrid())
            {
                return;
            }

            var myself = this;

            if (this.Genome.DNA.Execute(ref myself) == 0)
            {
                // If no action taken, kill ent
                this.TakeDamage(this.HealthValue);
            }
            else
            {
                this.TakeDamage(StaticController.GlobalEnviornmentDamagePerTurn);
            }

            if (!StaticController.GlobalForceFlat)
            {
                float healthPercent =
                    GameObjectGrid.GetHealthInRegion(GameObjectGrid.WorldToGridPosition(this.transform.position), StaticController.GlobalHeightBlendDistance) /
                    (float)StaticController.GlobalMaxInt;

                float yScale = healthPercent * StaticController.GlobalMaxHeight;

                this.transform.localScale =
                    new Vector3(
                        this.transform.localScale.x,
                        yScale,
                        this.transform.localScale.z);
            }
        }