Esempio n. 1
0
 void Start()
 {
     staminaRecoverer = gameObject.AddComponent <Stamina.StaminaRecoverer>();
     staminaRecoverer.Initialize(data);
     staminaConsumer = gameObject.AddComponent <Stamina.StaminaConsumer>();
     staminaConsumer.Initialize(data);
 }
Esempio n. 2
0
        public IEnumerator StaminaDoesNotRecovererIfStaminaIsFull()
        {
            GameObject gameObject = new GameObject();

            StaminaData staminaData = ScriptableObject.CreateInstance <StaminaData>();

            staminaData.maxStamina     = 20;
            staminaData.currentStamina = 20;

            Stamina.StaminaRecoverer staminaRecoverer = gameObject.AddComponent <Stamina.StaminaRecoverer>();
            staminaRecoverer.Initialize(staminaData);

            int initStamina = staminaData.currentStamina;

            staminaRecoverer.TryToRecover(5);
            yield return(null);

            Assert.AreEqual(staminaData.currentStamina, initStamina);

            Object.DestroyImmediate(gameObject);
            staminaData = null;
        }