public override void OnAdded(IGameObject pGameObject)
        {
            base.OnAdded(pGameObject);

            _traits = (TraitComponent)pGameObject.GetComponent(typeof(TraitComponent));//TODO

            _hunger = (int)_traits.GetTrait(TraitComponent.Traits.Hunger).Value;

            _lifeTime    = (int)_traits.GetTrait(TraitComponent.Traits.Lifetime).Value;
            _totalHealth = (int)_traits.GetTrait(TraitComponent.Traits.Health).Value;

            _stamina = (int)_traits.GetTrait(TraitComponent.Traits.Stamina).Value;

            var mateRate = (int)_traits.GetTrait(TraitComponent.Traits.MateRate).Value;

            if (mateRate == 0)
            {
                _mate = _lifeTime;
            }
            else
            {
                _mate = _lifeTime / mateRate;
            }

            _currentMate     = _mate;
            _currentHunger   = _hunger;
            _currentStamina  = _stamina;
            _currentLifetime = _lifeTime;
        }
Exemple #2
0
        public override void OnAdded(IGameObject pGameObject)
        {
            base.OnAdded(pGameObject);

            _vision     = (int)_traits.GetTrait(TraitComponent.Traits.Vision).Value;
            _speed      = (int)_traits.GetTrait(TraitComponent.Traits.Speed).Value;
            _gameObject = (Organism)GameObject;
        }