Inheritance: MonoBehaviour
Exemplo n.º 1
0
        //FUNCTIONS**************************************************
        private void CalculateHash()
        {
            string data = this.ChampionClass.ToString() + this.ChampionType.ToString() + this.Experience.ToString() +
                          this.Level.ToString() + this.Vitality.ToString() + CryptoRandom.Next(0, int.MaxValue - 1).ToString();

            this.Hash = GameGlobals.CalculateIndyvidualHash(data);
        }
    // Token: 0x0600146C RID: 5228 RVA: 0x000B4160 File Offset: 0x000B2360
    public static void DeleteAll()
    {
        int profile = GameGlobals.Profile;

        ClassGlobals.DeleteAll();
        ClubGlobals.DeleteAll();
        CollectibleGlobals.DeleteAll();
        ConversationGlobals.DeleteAll();
        DateGlobals.DeleteAll();
        DatingGlobals.DeleteAll();
        EventGlobals.DeleteAll();
        GameGlobals.DeleteAll();
        HomeGlobals.DeleteAll();
        MissionModeGlobals.DeleteAll();
        PlayerGlobals.DeleteAll();
        PoseModeGlobals.DeleteAll();
        SchemeGlobals.DeleteAll();
        SchoolGlobals.DeleteAll();
        SenpaiGlobals.DeleteAll();
        StudentGlobals.DeleteAll();
        TaskGlobals.DeleteAll();
        YanvaniaGlobals.DeleteAll();
        WeaponGlobals.DeleteAll();
        TutorialGlobals.DeleteAll();
        CounselorGlobals.DeleteAll();
        YancordGlobals.DeleteAll();
        CorkboardGlobals.DeleteAll();
        GameGlobals.Profile = profile;
        DateGlobals.Week    = 1;
    }
Exemplo n.º 3
0
 public virtual void MakeSelected()
 {
     if (!GameGlobals.PropertiesPanelOpen)
     {
         GameGlobals.SetPropertiesOpen(true);
     }
 }
Exemplo n.º 4
0
        public void TurnEngine_GetRandomMonsterItemDrops_Null_ItemList_Should_Skip()
        {
            MockForms.Init();

            var myTurnEngine = new TurnEngine();

            var roundCount = 2;

            // Make Sure Items List exists and is loaded...
            ItemsViewModel.Instance.ForceDataRefresh();

            // Clear data, and load again...
            ItemsViewModel.Instance.Dataset.Clear();

            // Don't init itemlist so exit with empty list...
            var Actual = myTurnEngine.GetRandomMonsterItemDrops(roundCount);

            // Should roll for 1 item, and return it...
            var Expected = 0;

            // Reset
            GameGlobals.ToggleRandomState();
            ItemsViewModel.Instance.ForceDataRefresh();

            Assert.AreEqual(Expected, Actual.Count(), TestContext.CurrentContext.Test.Name);
        }
Exemplo n.º 5
0
        public void TurnEngine_DetermineCriticalMissProblem_Attacker_Sword_Roll_1_Should_Return_Sword_Broke()
        {
            MockForms.Init();

            // Turn off random numbers
            // Set random to 1, and to hit to 1
            GameGlobals.SetForcedRandomNumbers(1, 1);
            GameGlobals.ForcedRandomValue = 1;

            var myTurnEngine = new TurnEngine();

            var myCharacter = new Character(DefaultModels.CharacterDefault());

            var itemGuid = ItemHelper.AddItemForAttribute(AttributeEnum.Attack, ItemLocationEnum.PrimaryHand, 1000).Guid;
            var myItem   = ItemsViewModel.Instance.GetItem(itemGuid);

            myCharacter.PrimaryHand = itemGuid; // Nothing in the hand, so nothing to drop...

            var Actual = myTurnEngine.DetermineCriticalMissProblem(myCharacter);

            var Expected = " Item " + myItem.Name + " from " + ItemLocationEnum.PrimaryHand + " Broke, and lost forever";

            // Reset
            GameGlobals.ToggleRandomState();

            Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name);
        }
Exemplo n.º 6
0
 private void Respawn()
 {
     transform.position = closestRespawnPoint();
     resetPosition();
     GameGlobals.startTime();
     alive = true;
 }
Exemplo n.º 7
0
        public void TurnEngine_GetRandomMonsterItemDrops_1_Roll_Level_3_Empty_ItemList_Should_Skip()
        {
            MockForms.Init();

            // Turn off random numbers
            // Set random to 1, and to hit to 1
            GameGlobals.SetForcedRandomNumbers(1, 1);

            var myTurnEngine = new TurnEngine();

            // Make Sure Items List exists and is loaded...
            ItemsViewModel.Instance.ForceDataRefresh();

            // Clear the items
            MockDataStore.Instance.DeleteTables();

            var roundCount = 3;

            // Don't init itemlist so exit with empty list...
            var Actual = myTurnEngine.GetRandomMonsterItemDrops(roundCount);

            // Should roll for 1 item, and return it...
            var Expected = 1;

            // Reset
            GameGlobals.ToggleRandomState();

            // Restor the database
            MockDataStore.Instance.InitializeDatabaseNewTables();

            Assert.AreEqual(Expected, Actual.Count(), "Item Count " + TestContext.CurrentContext.Test.Name);
        }
 public void DoGameOver()
 {
     gameState = GameStates.GAME_OVER;
     Player.gameObject.SetActive(false);
     GameGlobals.SetSessionData(currentWave, currentScore);
     Invoke("GameOverAfterExplosion", 0.85f);
 }
Exemplo n.º 9
0
        public void RoundEngine_RoundNextTurn_2Characters_1Monster_Weak_Should_Take_2_Turns()
        {
            MockForms.Init();

            bool reincarnation = GameGlobals.EnableReincarnation;

            GameGlobals.EnableReincarnation = false;

            // Can create a new Round engine...
            var myRoundEngine = new RoundEngine();

            // Start
            myRoundEngine.StartRound();

            // Add moderate monsters
            // First monster
            myRoundEngine.MonsterList.Clear();  // start fresh, because it was loaded already with 6...

            var myMonsterWeak = new Monster(DefaultModels.MonsterDefault());

            myMonsterWeak.ScaleLevel(5);
            myMonsterWeak.Attribute.CurrentHealth = 7; // need to set to enough to last 2 rounds...

            myRoundEngine.MonsterList.Add(myMonsterWeak);

            // Add weak character for first...
            var myCharacterWeak = new Character(DefaultModels.CharacterDefault());

            myCharacterWeak.ScaleLevel(10);
            myRoundEngine.CharacterList.Add(myCharacterWeak);

            // Add strong character for second
            var myCharacterStrong = new Character(DefaultModels.CharacterDefault());

            myCharacterStrong.ScaleLevel(20);
            myRoundEngine.CharacterList.Add(myCharacterStrong);

            // Should be Character 20, Character 10, Monster 5

            // Force rolls to 18 for to hit...
            // Turn off random numbers
            GameGlobals.SetForcedRandomNumbersValueAndToHit(1, 18);

            // Character, should kill the monster in the first round.
            // So the check for the second round will say Round over...
            var FirstRound  = myRoundEngine.RoundNextTurn();    // Character 20 Goes
            var SecondRound = myRoundEngine.RoundNextTurn();    // Character 10 Goes
            var Actual      = myRoundEngine.RoundNextTurn();    // Over...


            // Reset
            GameGlobals.ToggleRandomState();

            var Expected = RoundEnum.NextTurn;

            Assert.AreEqual(Expected, Actual, "Status " + TestContext.CurrentContext.Test.Name);
            Assert.AreEqual(3, myRoundEngine.BattleScore.TurnCount, "TurnCount " + TestContext.CurrentContext.Test.Name);
            //Assert.AreEqual(4, myRoundEngine.BattleScore.RoundCount, "RoundCount " + TestContext.CurrentContext.Test.Name);
            GameGlobals.EnableReincarnation = reincarnation;
        }
Exemplo n.º 10
0
        async void AutoBattleButton_OnClicked(object sender, EventArgs e)
        {
            var success = _viewModel.AutoBattle();

            if (success == 0)
            {
                //if auto battle can run successfully, it calls item post call to get items
                GameGlobals.PostCallAsync();

                //I figured that there is no need to display all the items
                //var myOutput = GameGlobals.Output;
                //var answer = await DisplayAlert("Returned List", myOutput, "Yes", "No");

                await Navigation.PushAsync(new ScoreDetailPage(new ScoreDetailViewModel(_viewModel.BattleScore)));
            }
            else if (success == -1)
            {
                await DisplayAlert("Alert", "Please have at least 6 characters to play Auto Battle", "OK");
            }
            else if (success == -2)
            {
                await DisplayAlert("Alert", "Please have at least 1 monster to play Auto Battle", "OK");
            }
            else
            {
                await DisplayAlert("Alert", "Please have at least 1 item to play Auto Battle", "OK");
            }
        }
Exemplo n.º 11
0
    // Start the game; update the game start to PLAYING,
    public void StartGame()
    {
        Player.gameLogicManager = this;

        // Set all Shields to active:
        int shieldCnt = PlayerShields.Length;

        for (int cnt = 0; cnt < shieldCnt; cnt++)
        {
            Transform playerShield = PlayerShields[cnt];
            for (int childNdx = 0; childNdx < playerShield.childCount; childNdx++)
            {
                playerShield.GetChild(childNdx).gameObject.SetActive(true);
            }
        }

        Player.restart();

        currentScore = 0;
        currentWave  = 1;
        GameGlobals.SetSessionData(currentWave, currentScore);

        updateScore();
        updateWave();
        drawEnemies();

        this.Player.autoMode = false;
        gameState            = GameStates.PLAYING;
    }
Exemplo n.º 12
0
        async void BattlePageButton_OnClicked(object sender, EventArgs e)
        {
            //post call to get all the items
            GameGlobals.PostCallAsync();

            await Navigation.PushAsync(new CharacterSelectionPage());
        }
Exemplo n.º 13
0
        public TileTypeDictionary() : base()
        {
            var fileName = GameGlobals.Instance().Get <string>("textureDir");

            if (!File.Exists(fileName))
            {
                fileName = @"G:\Programming\CSConsoleRL\CSConsoleRL\CSConsoleRL\bin\x64\Debug\Data\Sprites\Tiles20x20.png";
            }
            if (!File.Exists(fileName))
            {
                fileName = @"F:\Programming\CSConsoleRL\Data\Sprites\Tiles20x20.png";
            }
            if (!File.Exists(fileName))
            {
                fileName = @"/home/jason/dev/CSConsoleRL/Data/Sprites/Tiles20x20.png";
            }
            Add(EnumTileTypes.Snow, new TileData('~', new Texture(fileName, new IntRect(0, 0, 20, 20)), ConsoleColor.Gray, false, false, false));
            Add(EnumTileTypes.SnowWalked, new TileData('8', new Texture(fileName, new IntRect(20, 20, 20, 20)), ConsoleColor.Gray, false, false, false));
            Add(EnumTileTypes.Road, new TileData('-', new Texture(fileName, new IntRect(0, 0, 20, 20)), ConsoleColor.DarkGray, false, false, false));
            Add(EnumTileTypes.Grass, new TileData(';', new Texture(fileName, new IntRect(0, 0, 20, 20)), ConsoleColor.Green, false, false, false));
            Add(EnumTileTypes.CabinWall, new TileData('=', new Texture(fileName, new IntRect(0, 60, 20, 20)), ConsoleColor.DarkMagenta, true, true, true));
            Add(EnumTileTypes.CabinFloor, new TileData('+', new Texture(fileName, new IntRect(0, 40, 20, 20)), ConsoleColor.DarkMagenta, false, false, false));
            Add(EnumTileTypes.CabinDoor, new TileData('%', new Texture(fileName, new IntRect(0, 40, 20, 20)), ConsoleColor.DarkMagenta, false, true, true));
            Add(EnumTileTypes.Tree, new TileData('T', new Texture(fileName, new IntRect(0, 20, 20, 20)), ConsoleColor.DarkGreen, true, true, true));
            Add(EnumTileTypes.River, new TileData('^', new Texture(fileName, new IntRect(0, 100, 20, 20)), ConsoleColor.Blue, true, false, false));
            Add(EnumTileTypes.CabinWindow, new TileData('_', new Texture(fileName, new IntRect(0, 80, 20, 20)), ConsoleColor.DarkMagenta, true, false, false));
            Add(EnumTileTypes.Mountain, new TileData('^', new Texture(fileName, new IntRect(40, 20, 20, 20)), ConsoleColor.DarkGray, true, true, true));
        }
Exemplo n.º 14
0
    void OnGUI()
    {
        GUIStyle backgroundStyle = new GUIStyle();

        backgroundStyle.normal.background = backdrop;

        GUI.Label(new Rect((Screen.width - (Screen.height * 2)) * 0.75f, 0, Screen.height * 2f, Screen.height), "", backgroundStyle);

        GUI.Label(new Rect((Screen.width / 2) - 197, 200, 400, 100), "JunkRobot", "mainMenuTitle");

        if (GUI.Button(new Rect((Screen.width / 2) - 70, Screen.height - 160, 140, 70), "Play"))
        {
            isLoading = true;
            Application.LoadLevel(GameGlobals.getCurrentLevel());
            GameGlobals.startTime();
        }

        bool isWebPlayer = (Application.platform == RuntimePlatform.OSXWebPlayer ||
                            Application.platform == RuntimePlatform.WindowsWebPlayer);

        if (!isWebPlayer)
        {
            if (GUI.Button(new Rect((Screen.width / 2) - 70, Screen.height - 80, 140, 70), "Quit"))
            {
                Application.Quit();
            }
        }

        if (isLoading)
        {
            GUI.Label(new Rect((Screen.width / 2) - 110, (Screen.height / 2) - 60, 400, 70),
                      "Loading...", "mainMenuTitle");
        }
    }
Exemplo n.º 15
0
        public void TurnEngine_TurnAsAttack_Monster_Attack_DefenderList_Miss_Should_Pass()
        {
            MockForms.Init();

            // Turn off random numbers
            GameGlobals.SetForcedRandomNumbersValueAndToHit(1, 20);

            var Attacker = DefaultModels.MonsterDefault();

            Attacker.Name = "Rat";

            var myDefaultCharacter = new Character(DefaultModels.CharacterDefault());

            myDefaultCharacter.Name = "Fighter";
            myDefaultCharacter.ScaleLevel(20);

            var myTurnEngine = new TurnEngine();

            myTurnEngine.CharacterList.Add(myDefaultCharacter);

            GameGlobals.ForceToHitValue = 2; // Force a miss

            var AttackScore  = Attacker.Level + Attacker.GetAttack();
            var DefenseScore = myDefaultCharacter.GetDefense() + myDefaultCharacter.Level;

            var Status = myTurnEngine.TurnAsAttack(Attacker, AttackScore, myDefaultCharacter, DefenseScore);

            var  Actual   = Status;
            bool Expected = true;

            // Reset
            GameGlobals.ToggleRandomState();

            Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name);
        }
        public void Character_ScaleLevel_Level_2_Forced_5_Should_Return_MaxHealth_10()
        {
            //Health, Attack, Defense, Speed
            int[] BaseClassBaseStats    = { 5, 4, 3, 4 };
            int[] MageClassBaseStats    = { 4, 7, 3, 4 };
            int[] KnightClassBaseStats  = { 6, 6, 6, 2 };
            int[] AssasinClassBaseStats = { 3, 5, 3, 8 };

            // Base stats.
            int[][] ClassBaseStats = { BaseClassBaseStats, MageClassBaseStats, KnightClassBaseStats, AssasinClassBaseStats };

            // Arrange
            var Test     = new Character();
            int Level    = 2;
            int Expected = ClassBaseStats[Test.ClassCode()][0] + 5;  // Expected MaxHealth

            // Turn on Forced Values
            GameGlobals.SetForcedRandomNumbersValue(5);

            // Act
            var Actual = Test.ScaleLevel(Level);

            // Reset
            GameGlobals.DisableRandomValues();

            // Assert
            Assert.AreEqual(Expected, Test.GetHealthMax(), TestContext.CurrentContext.Test.Name);
        }
Exemplo n.º 17
0
    // Use this for initialization
    void Start()
    {
        float fZPos        = 0.0f;
        float fFloorLength = Mathf.Abs(m_fFloorStartZ) + Mathf.Abs(m_fFloorEndZ);

        m_fMovementSpeed = m_fMinMovementSpeed;

        Debug.Log("Floor length is: " + fFloorLength.ToString());

        while (fZPos > -(fFloorLength - 15))
        {
            SpawnNewFloor(fZPos);
            fZPos -= 5.0f;
        }

        SpawnNewFloor(fZPos, false);
        fZPos -= 5.0f;
        SpawnNewFloor(fZPos, false);
        fZPos -= 5.0f;
        SpawnNewFloor(fZPos, false);
        fZPos -= 5.0f;

        m_fBaddieSpawnEventTime = Time.time;
        m_fCoinSpawnEventTime   = Time.time;

        m_gcGameGlobals = GameGlobals.Instance;
    }
Exemplo n.º 18
0
    private void _updateRotation()
    {
        Vector3 look = GameGlobals.LazyLookAt(this.gameObject, m_TargetPosition, m_PositiveDirection);

        m_BeamEnd.transform.right   = look;
        m_BeamStart.transform.right = look;
    }
Exemplo n.º 19
0
        public void TurnEngine_GetRandomMonsterItemDrops_Null_ItemList_Should_Skip()
        {
            MockForms.Init();

            var myTurnEngine = new TurnEngine();

            var roundCount = 2;

            // Make Sure Items List exists and is loaded...
            var myItemsViewModel = ItemsViewModel.Instance;
            var canExecute       = myItemsViewModel.LoadDataCommand.CanExecute(null);

            myItemsViewModel.LoadDataCommand.Execute(null);

            // Clear data, and load again...
            myItemsViewModel.Dataset.Clear();

            // Don't init itemlist so exit with empty list...
            var Actual = myTurnEngine.GetRandomMonsterItemDrops(roundCount);

            // Should roll for 1 item, and return it...
            var Expected = 0;

            // Reset
            GameGlobals.ToggleRandomState();
            MockDataStore.Instance.InitializeDatabaseNewTables();

            Assert.AreEqual(Expected, Actual.Count(), TestContext.CurrentContext.Test.Name);
        }
Exemplo n.º 20
0
    protected override void Awake()
    {
        base.Awake();

        m_BeamStart = GameGlobals.AttachCheckComponent <SpriteRenderer>(
            Instantiate(beamStart, this.transform));
        m_BeamStart.color = beamColor;
        m_BeamStart.transform.localScale = m_BeamStart.transform.localScale * beamWidth;
        m_DefaultStartFlipX = m_BeamStart.flipX;

        m_BeamMiddle = GameGlobals.AttachCheckComponent <SpriteRenderer>(
            Instantiate(beamMiddle, this.transform));
        m_BeamMiddle.color = beamColor;
        m_BeamMiddle.transform.localScale = m_BeamMiddle.transform.localScale * beamWidth;

        m_BeamEnd = GameGlobals.AttachCheckComponent <SpriteRenderer>(
            Instantiate(beamEnd, this.transform));
        m_BeamEnd.color = beamColor;
        m_BeamEnd.transform.localScale = m_BeamEnd.transform.localScale * beamWidth;
        m_DefaultEndFlipX = m_BeamEnd.flipX;

        m_TargetMask = ((Target == TargetType.AnyTarget) || otherTeamBlocks) ?
                       BattleGlobals.GetBattleNPCLayerMask() : ((Target == TargetType.AlliedTargets) ?
                                                                BattleGlobals.GetAlliedLayerMask(ParentSkill.SkillOwner.tag) :
                                                                BattleGlobals.GetEnemyLayerMask(ParentSkill.SkillOwner.tag));
    }
Exemplo n.º 21
0
        public void TurnEngine_GetRandomMonsterItemDrops_1_Roll_Level_3_Good_ItemList_Should_Return_List()
        {
            MockForms.Init();

            // Turn off random numbers
            // Set random to 1, and to hit to 1
            GameGlobals.SetForcedRandomNumbers(2, 1);

            var myTurnEngine = new TurnEngine();

            var roundCount = 2;

            // Make Sure Items List exists and is loaded...
            ItemsViewModel.Instance.ForceDataRefresh();

            // Don't init itemlist so exit with empty list...
            var Actual = myTurnEngine.GetRandomMonsterItemDrops(roundCount);

            // Should roll for 1 item, and return it...
            var Expected = 2;

            // Reset
            GameGlobals.ToggleRandomState();

            Assert.AreEqual(Expected, Actual.Count(), "Item Count " + TestContext.CurrentContext.Test.Name);
            Assert.AreEqual(roundCount, Actual.FirstOrDefault().Value, "Item Level " + TestContext.CurrentContext.Test.Name);
        }
Exemplo n.º 22
0
 /*
  * Get SpriteRenderer, BattleNPC that owns this skill, & Bytes attached to skill
  * Disable this skill, until it is used
  */
 protected virtual void Awake()
 {
     SkillSpriteRenderer = GameGlobals.AttachCheckComponent <SpriteRenderer>(this.gameObject);
     SkillOwner          = GameGlobals.AttachCheckComponentParent <BattleNPC>(this.gameObject);
     m_ManagedBytes      = GetComponents <SkillByte>();
     ResetSkill();
 }
Exemplo n.º 23
0
        public void TurnEngine_DetermineCriticalMissProblem_Attacker_Null_Roll_1_Should_Return_Nothing_Broke()
        {
            MockForms.Init();

            // Turn off random numbers
            // Set random to 1, and to hit to 1
            GameGlobals.SetForcedRandomNumbers(1, 1);
            GameGlobals.ForcedRandomValue = 1;

            var myTurnEngine = new TurnEngine();

            var myCharacter = new Character(DefaultModels.CharacterDefault());

            myCharacter.PrimaryHand = null; // Nothing in the hand, so nothing to drop...

            var Actual = myTurnEngine.DetermineCriticalMissProblem(myCharacter);

            // Should roll for 1 item, and return it...
            var Expected = " Luckly, nothing to drop from PrimaryHand";

            // Reset
            GameGlobals.ToggleRandomState();

            Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name);
        }
Exemplo n.º 24
0
    // Use this for initialization
    void Start()
    {
        var items = GameGlobals.PopItemTransfer();

        foreach (var item in items)
        {
            Debug.Log("instantiating");
            GameObject newObj = null;
            foreach (var prefab in prefabs)
            {
                if (prefab.name == item.name)
                {
                    newObj = GameObject.Instantiate(prefab);
                    newObj.GetComponent <ITransferrable>().Initialize(item);
                    break;
                }
            }
            if (newObj != null)
            {
                newObj.transform.SetParent(slots[item.targetSlot]);
                newObj.transform.localPosition = Vector3.zero;
                newObj.transform.localRotation = Quaternion.identity;
                newObj.transform.localScale    = Vector3.one;
            }
        }
    }
Exemplo n.º 25
0
        public void TurnEngine_TurnAsAttack_Monster_Attack_DefenderList_CriticalMiss_Should_Pass()
        {
            // Turn off random numbers
            GameGlobals.SetForcedRandomNumbers(1, 20);

            var Attacker = DefaultModels.MonsterDefault();

            Attacker.Name = "Rat";

            var myDefaultCharacter = DefaultModels.CharacterDefault();

            myDefaultCharacter.Name = "Fighter";

            var myTurnEngine = new TurnEngine();

            myTurnEngine.CharacterList.Add(myDefaultCharacter);

            GameGlobals.ForceToHitValue = 1; // Force a miss

            var AttackScore  = Attacker.Level + Attacker.GetAttack();
            var DefenseScore = myDefaultCharacter.GetDefense() + myDefaultCharacter.Level;

            var  Status   = myTurnEngine.TurnAsAttack(Attacker, AttackScore, myDefaultCharacter, DefenseScore);
            var  Actual   = Status;
            bool Expected = true;

            var ActualString = myTurnEngine.TurnMessage;
            var ActualResult = myTurnEngine.HitStatus;
            var ActualDamage = myTurnEngine.DamageAmount;

            // Reset
            GameGlobals.ToggleRandomState();

            Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name);
        }
Exemplo n.º 26
0
    public void StartGame()
    {
        // Spawn the player offscreen. SetPlayerDefaults locks it and prevents movement.
        // Player Object remains in the persistent scene, so we don't need to care
        // about what happens between scene loads...
        {
            m_goPlayerObjectReference = GameInstance.Instantiate(m_goPlayerPrefab, new Vector3(100, 100, 0), Quaternion.identity);
            GAssert.Assert(null != m_goPlayerObjectReference, "Unable to instantiate Player Object");
            m_gcPlayerState = m_goPlayerObjectReference.GetComponent <PlayerState>();
            GAssert.Assert(null != m_gcPlayerState, "Unable to get Player State");
            m_gcPlayerController = m_goPlayerObjectReference.GetComponent <PlayerController>();
            GAssert.Assert(null != m_gcPlayerController, "Unable to get Player Controller");
            m_gcPlayerInventory = m_goPlayerObjectReference.GetComponent <PlayerInventory>();
            GAssert.Assert(null != m_gcPlayerInventory, "Unable to get Player Inventory!");
        }

        // Set Game Defaults
        {
            Messenger.ClearAll();
            TimerManager.SetDefaults(1.0f, 1.0f);
            m_gcPlayerInventory.SetDefaults();
            m_gcPlayerState.SetDefaults();
            m_gcGameCamera.SetDefaults();
            GameGlobals.SetDefaults();

            // Put the player in the correct position!
            // GNTODO: This needs to be loaded!
            //
            {
                // teleportPlayerToSpawnPoint...
            }
        }
    }
Exemplo n.º 27
0
        public override void Update(Vector2 _offset)
        {
            if (Globals.keyboard.GetPress("A"))
            {
                pos = new Vector2(pos.X - speed, pos.Y);
            }
            if (Globals.keyboard.GetPress("D"))
            {
                pos = new Vector2(pos.X + speed, pos.Y);
            }
            if (Globals.keyboard.GetPress("W"))
            {
                pos = new Vector2(pos.X, pos.Y - speed);
            }
            if (Globals.keyboard.GetPress("S"))
            {
                pos = new Vector2(pos.X, pos.Y + speed);
            }

            if (Globals.mouse.LeftClick())
            {
                GameGlobals.PassProjectile(new Bullet("2d\\bullet", new Vector2(pos.X, pos.Y), new Vector2(100, 100), this, new Vector2(Globals.mouse.newMousePos.X, Globals.mouse.newMousePos.Y)));
            }

            base.Update(_offset);
        }
Exemplo n.º 28
0
        public void BattleEngine_AutoBattle_With_No_Initial_Characters_Should_Pass()
        {
            MockForms.Init();

            // Can create a new battle engine...
            var myBattleEngine = new BattleEngine();

            // Add new myCharacters in automaticaly
            // Characters are Level 1
            // Monsters are Level 1
            // Monsters will kill Characters in round 1.

            // Turn off random numbers
            // For a hit on everything...
            GameGlobals.SetForcedRandomNumbers(1, 20);  // Needs to be 20 so monsters always score a hit...

            MasterDataStore.ForceDataRestoreAll();

            myBattleEngine.AutoBattle();

            // Reset
            GameGlobals.ToggleRandomState();

            var Actual = myBattleEngine.BattleScore;

            Assert.AreNotEqual(1, Actual.RoundCount, "Round Count " + TestContext.CurrentContext.Test.Name);

            Assert.AreNotEqual(null, Actual, "Score Object " + TestContext.CurrentContext.Test.Name);
            Assert.AreNotEqual(0, Actual.ExperienceGainedTotal, "Experience " + TestContext.CurrentContext.Test.Name);
            Assert.AreNotEqual(0, Actual.TurnCount, "Turn Count " + TestContext.CurrentContext.Test.Name);
            Assert.AreNotEqual(0, Actual.ScoreTotal, "Score Total " + TestContext.CurrentContext.Test.Name);
            Assert.AreNotEqual(string.Empty, Actual.ItemsDroppedList, "Items Dropped " + TestContext.CurrentContext.Test.Name);
            Assert.AreNotEqual(string.Empty, Actual.MonstersKilledList, "Monsters Killed " + TestContext.CurrentContext.Test.Name);
            Assert.AreNotEqual(string.Empty, Actual.CharacterAtDeathList, "Character List " + TestContext.CurrentContext.Test.Name);
        }
Exemplo n.º 29
0
    // GameInstance will call this when the player passes through a doorway,
    // initiating the transition between two rooms...
    //
    // For us, it's the start of the little mini game, so we need to verify
    // our settings and then begin spawning in waves...
    //
    public override void OnRoomEnter()
    {
        // When the game is finished we set a GameEvent so this mini-game can't be repeated
        switch (m_iEvent)
        {
        case ERobotronEvents._RB1_IckleBaddies: m_iEventBitField = Types.s_iGE_RobotronTest; break;

        case ERobotronEvents._RB2_Enforcers: m_iEventBitField = Types.s_iGE_Robotron2; break;

        case ERobotronEvents._RB3_FloatingLaserBrains: m_iEventBitField = Types.s_iGE_Robotron3; break;

        case ERobotronEvents._RB4_LoadsaBaddies: m_iEventBitField = Types.s_iGE_Robotron4; break;

        case ERobotronEvents._RB5_CircularShotTwats: m_iEventBitField = Types.s_iGE_Robotron5; break;
        }

        // If we've already completed this room, do nothing!
        if (GameGlobals.TestGameEvent(m_iEventBitField))
        {
            return;
        }

        // Spawn in the warning Prefab...
        if (null != m_goWarningPrefab)
        {
            Instantiate(m_goWarningPrefab, transform.position, Quaternion.identity);
        }

        // Validate what we need
        {
            GAssert.Assert(null != m_SpawnSet._goEnemyPrefab, "Robotron Room Controller has no Enemy Prefab Assigned!");
            GAssert.Assert(null != m_SpawnSet._goSpawnInEffect, "Robotron Room Controller has Spawn In Effect");
            GAssert.Assert(null != m_SpawnSet._goSpawnWarningEffect, "Robotron Room Controller has Spawn Warning Prefab");
            GAssert.Assert(null != m_SpawnSet._goSpawnWarningEffectShort, "Robotron Room Controller missing spawn effect short");
        }

        // Init any additional objects, these aren't tracked as part of the unlock sequence
        {
            foreach (GameObject go in m_aAdditionalObjects)
            {
                if (null == go)
                {
                    continue;
                }
                go.SetActive(true);
                Types.IRoom_EnemyObject[] aGC = go.GetComponents <Types.IRoom_EnemyObject>();
                foreach (Types.IRoom_EnemyObject gc in aGC)
                {
                    gc.OnRoomEnter();
                }
            }
        }

        m_vRoomOrigin  = GameMode.GetRoomOrigin();
        m_aRoomObjects = new GameObject[m_iEnemiesToSpawn * m_iNumberOfWaves];
        m_bIsActive    = true;

        // Wait for the door to shut before we kick things off...
        m_iTimerHandle = TimerManager.AddTimer(Types.s_fDUR_RoomEntryDoorCloseDelay + 0.35f, FinaliseRoomEntry);
    }
Exemplo n.º 30
0
    public void Update()
    {
        if (GameGlobals.TestGameEvent(Types.s_iGE_FirstSpawners))
        {
            return;
        }

        // If we don't have objects...
        bool bHaveObjects = false;

        foreach (GameObject go in m_aRoomObjects)
        {
            if (null != go)
            {
                bHaveObjects = true;
            }
        }

        // Open the door and set the event...
        if (!bHaveObjects)
        {
            m_aDoorRight.Open();
            GameGlobals.SetGameEvent(Types.s_iGE_FirstSpawners);
        }
    }