Ejemplo n.º 1
0
        public void ShouldAddToBalance()
        {
            BalanceSystem balanceSystem = new BalanceSystem();

            balanceSystem.Balance(3);
            Assert.AreEqual(3, balanceSystem.balance);
        }
Ejemplo n.º 2
0
 public static void SetupObjects()
 {
     SaveGame.m_Objects.Clear();
     SaveGame.m_Objects.Add(MainLevel.Instance);
     SaveGame.m_Objects.Add(Scenario.Get());
     SaveGame.m_Objects.Add(AIManager.Get());
     SaveGame.m_Objects.Add(TriggersManager.Get());
     SaveGame.m_Objects.Add(ItemsManager.Get());
     SaveGame.m_Objects.Add(SensorManager.Get());
     SaveGame.m_Objects.Add(ConstructionGhostManager.Get());
     SaveGame.m_Objects.Add(StaticObjectsManager.Get());
     SaveGame.m_Objects.Add(Player.Get());
     SaveGame.m_Objects.Add(PlayerConditionModule.Get());
     SaveGame.m_Objects.Add(PlayerInjuryModule.Get());
     SaveGame.m_Objects.Add(PlayerDiseasesModule.Get());
     SaveGame.m_Objects.Add(StatsManager.Get());
     SaveGame.m_Objects.Add(HintsManager.Get());
     SaveGame.m_Objects.Add(ObjectivesManager.Get());
     SaveGame.m_Objects.Add(HUDObjectives.Get());
     SaveGame.m_Objects.Add(MenuNotepad.Get());
     SaveGame.m_Objects.Add(MapTab.Get());
     SaveGame.m_Objects.Add(Music.Get());
     SaveGame.m_Objects.Add(RainManager.Get());
     SaveGame.m_Objects.Add(BalanceSystem.Get());
 }
Ejemplo n.º 3
0
 protected override void Start()
 {
     this.m_StartPosition = base.transform.position;
     this.m_StartForward  = base.transform.forward;
     base.Start();
     this.InitWeapons();
     this.InitHair();
     Debug.Log("HumanAI - " + ((!this.m_Group) ? "No group" : this.m_Group.GetType().ToString()));
     BalanceSystem.Get().LogCooldowns();
 }
Ejemplo n.º 4
0
        public void ShouldSetCardInsertedToTrueAfterCallingTakeCard()
        {
            Display       display       = new Display();
            Keypad        keypad        = new Keypad();
            BalanceSystem balanceSystem = new BalanceSystem();
            CardSlot      cardSlot      = new CardSlot(display, keypad);

            cardSlot.TakePayment(balanceSystem);
            Assert.AreEqual(true, cardSlot.cardInserted);
        }
        public void ShouldSetBalanceTo0WhenDispensed()
        {
            ChangeDispenser changeDispenser = new ChangeDispenser();
            BalanceSystem   balanceSystem   = new BalanceSystem();

            balanceSystem.balance = 10;

            changeDispenser.DispenseChange(balanceSystem);

            Assert.AreEqual(0, balanceSystem.balance);
        }
Ejemplo n.º 6
0
        public void ShouldAssignTheBalance()
        {
            BalanceSystem balanceSystem = new BalanceSystem();
            Display       display       = new Display();

            balanceSystem.Balance(2.80M);

            display.DisplayBalance(balanceSystem);

            Assert.AreEqual(2.80M, balanceSystem.balance);
        }
Ejemplo n.º 7
0
 protected virtual void OnActivate()
 {
     if (this.IsWave())
     {
         BalanceSystem.Get().OnHumanAIWaveActivated();
     }
     else if (this.m_FromBalance)
     {
         BalanceSystem.Get().OnHumanAIGroupActivated();
     }
     this.SetupState();
 }
Ejemplo n.º 8
0
 protected virtual void OnDeactivate()
 {
     if (this.IsWave())
     {
         BalanceSystem.Get().OnHumanAIWaveDeactivated(this.m_Members.Count == 0);
     }
     else if (this.m_FromBalance)
     {
         BalanceSystem.Get().OnHumanAIGroupDeactivated(this.m_Members.Count == 0);
     }
     this.SetState(HumanAIGroup.State.None);
 }
Ejemplo n.º 9
0
        private bool CanSpawn()
        {
            if (AIManager.Get() == null)
            {
                return(false);
            }
            if (this.m_ID == AI.AIID.Jaguar && !BalanceSystem.Get().CanSpawnJaguar())
            {
                return(false);
            }
            int num = (!MainLevel.Instance.IsNight()) ? this.m_DayCount : this.m_NightCount;

            return(this.m_AICount < num && (!this.m_SpawnersGroup || this.m_SpawnersGroup.CanSpawnAI()));
        }
Ejemplo n.º 10
0
 public void Update()
 {
     if (this.ShouldSpawnWave() || (GreenHellGame.DEBUG && Input.GetKeyDown(KeyCode.Z)))
     {
         this.SpawnWave(UnityEngine.Random.Range(1, BalanceSystem.Get().GetCurrentHumanAISpawnCount() + 1), false);
     }
     if (this.m_ActiveWaves.Count == 0)
     {
         this.m_TimeFromLastWave += Time.deltaTime;
     }
     else
     {
         this.m_TimeFromLastWave = 0f;
     }
 }
Ejemplo n.º 11
0
 private void Update()
 {
     if (this.m_ActiveChallenge != null)
     {
         if (!MainLevel.Instance)
         {
             this.m_ActiveChallenge = null;
             return;
         }
         if (!this.m_HumanAICooldownSet && BalanceSystem.Get())
         {
             BalanceSystem.Get().m_HumanAIStaticCooldown = 0f;
             BalanceSystem.Get().m_HumanAIWaveCooldown   = 0f;
             this.m_HumanAICooldownSet = true;
         }
         this.m_ActiveChallenge.Update();
     }
 }
Ejemplo n.º 12
0
 public void Activate()
 {
     base.gameObject.SetActive(true);
     foreach (GameObject gameObject in this.m_AllObjects)
     {
         gameObject.SetActive(true);
     }
     if (!this.m_ChallengeGroup && this.m_FromBalance)
     {
         int currentHumanAISpawnCount = BalanceSystem.Get().GetCurrentHumanAISpawnCount();
         while (this.m_Members.Count > currentHumanAISpawnCount)
         {
             HumanAI humanAI = this.m_Members[UnityEngine.Random.Range(0, this.m_Members.Count)];
             this.RemovedAI(humanAI);
             UnityEngine.Object.Destroy(humanAI.gameObject);
         }
     }
     this.m_Active = true;
     this.OnActivate();
 }
Ejemplo n.º 13
0
 protected override void Start()
 {
     this.m_Params = AIManager.Get().m_AIParamsMap[(int)this.m_ID];
     if (this.m_Params.m_BigAnimal)
     {
         this.m_SoundModule = base.gameObject.AddComponent <BigAnimalSoundModule>();
     }
     AIManager.Get().RegisterAI(this);
     base.Start();
     this.m_StartExecuted = true;
     this.OnEnable();
     if (this.m_ID == AI.AIID.Jaguar)
     {
         BalanceSystem.Get().OnJaguarActivated();
     }
     AudioSource[] components = base.GetComponents <AudioSource>();
     foreach (AudioSource audioSource in components)
     {
         audioSource.rolloffMode = AudioRolloffMode.Linear;
     }
 }
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            // A unique case where the Singleton exists but not in this scene
            if (instance.gameObject.scene.name == null)
            {
                instance = this;
            }
            else
            {
                Destroy(this);
            }
        }

        anim = GetComponentInParent <Animator>();
    }
Ejemplo n.º 15
0
 public void OnLevelLoaded()
 {
     this.m_ActiveChallenge = null;
     this.m_Parent          = GameObject.FindGameObjectWithTag("Challenges");
     if (!this.m_Parent)
     {
         return;
     }
     if (this.m_ChallengeToActivate == string.Empty)
     {
         UnityEngine.Object.Destroy(this.m_Parent);
         return;
     }
     for (int i = 0; i < this.m_Parent.transform.childCount; i++)
     {
         this.m_Parent.transform.GetChild(i).gameObject.SetActive(false);
     }
     foreach (Challenge challenge in this.m_Challenges)
     {
         if (challenge.m_Name == this.m_ChallengeToActivate)
         {
             Transform exists = this.m_Parent.transform.Find(challenge.m_ParentName);
             if (!exists)
             {
                 return;
             }
             challenge.Activate(this.m_Parent.transform.Find(challenge.m_ParentName).gameObject);
             this.m_ActiveChallenge = challenge;
             if (BalanceSystem.Get())
             {
                 BalanceSystem.Get().m_HumanAIStaticCooldown = 0f;
                 BalanceSystem.Get().m_HumanAIWaveCooldown   = 0f;
                 this.m_HumanAICooldownSet = true;
             }
             break;
         }
     }
     this.m_ChallengeToActivate = string.Empty;
 }
Ejemplo n.º 16
0
 public void SetBalanceSystem(BalanceSystem system)
 {
     this.m_BalanceSystem = system;
 }
Ejemplo n.º 17
0
 private bool ShouldSpawnWave()
 {
     return(HumanAIGroupManager.Get() && GreenHellGame.Instance.m_GameDifficulty == GameDifficulty.Hard && !this.m_BlockSpawnWaves && BalanceSystem.Get().CanSpawnHumanAIWave());
 }
Ejemplo n.º 18
0
 private bool CanSpawnGroupFromBalanceSystem()
 {
     return(BalanceSystem.Get() && BalanceSystem.Get().CanSpawnHumanAIGroup());
 }