Exemple #1
0
        public void ResetPetState()
        {
            var previousAge = Age;

            _age = 0;
            AgeChanged?.Invoke(this, new AgeChangedEventArgs(previousAge, Age));
            Mood            = Satiety = Health = CleanessRate = 100;
            _evolutionLevel = PetEvolutionLevel.Birth;
            EvolutionLevelChanged?.Invoke(this, new PetEvolutionLevelChangedEventArgs(_evolutionLevel));
        }
Exemple #2
0
        private void SetAge(float newAge)
        {
            if (newAge > _age)
            {
                var previousAge = _age;
                _age = newAge;
                AgeChanged?.Invoke(this, new AgeChangedEventArgs(previousAge, newAge));
            }

            if (Age == _lifeDuration)
            {
                PetDied?.Invoke(this, EventArgs.Empty);
            }
        }
 protected virtual void OnAgeChanged(int oldValue, int newValue)
 {
     AgeChanged?.Invoke(this, new AgeChangedEventArgs(this, oldValue, newValue));
 }
Exemple #4
0
 protected virtual void OnAgeChanged(AgeChangedEventArgs e)
 {
     // If AgeChange == null then do nothing
     AgeChanged?.Invoke(this, e);
 }
 void OnYearTicked(object sender, TimeComponent.TimeEventArgs e)
 {
     Age += 1;
     AgeChanged?.Invoke(this, new AgeChangedEventArgs(Age));
 }