Ejemplo n.º 1
0
    private void Awake()
    {
        if (Instance != null && Instance != this)
        {
            // If that is the case, we destroy other instances
            Destroy(gameObject);
        }

        // Here we save our singleton instance
        Instance = this;

        // Furthermore we make sure that we don't destroy between scenes (this is optional)
        //DontDestroyOnLoad(gameObject);


        _listSpriteSkill  = Resources.LoadAll <Sprite>("Textures/Skill");
        _listSpriteEffect = Resources.LoadAll <Sprite>("Textures/Buff");


        DiceBtn.onClick.AddListener(CallEventRollDice);
        _startOrderAction.onClick.AddListener(CallEventStartOrderAction);
        _gameOverOk.onClick.AddListener(BackToMainMenu);
        _leaveGameBtn.onClick.AddListener(SurrenderAndLeaveGame);
        _resumeBtn.onClick.AddListener(ResumeGame);
        _surrenderBtn.onClick.AddListener(DisplaySurrenderPanel);
        _toggleMeBuffBtn.onClick.AddListener(ShowHideMeBuffPanel);
        _toggleEnemyBuffBtn.onClick.AddListener(ShowHideEnemyBuffPanel);
    }
Ejemplo n.º 2
0
        public void LoadContent(ContentManager Content)
        {
            // Load all the sprite sheets
            testCharacterSpriteSheet = Content.Load <Texture2D>("Images/character_test");
            jesusSpriteSheet         = Content.Load <Texture2D>("Images/Characters/sprites_characters_jesus1");
            hitlerSpriteSheet        = Content.Load <Texture2D>("Images/Characters/sprites_characters_hitler1");
            einsteinSpriteSheet      = Content.Load <Texture2D>("Images/Characters/sprites_characters_einstein1");
            washingtonSpriteSheet    = Content.Load <Texture2D>("Images/Characters/sprites_characters_washington1");
            testLevelTileSheet       = Content.Load <Texture2D>("Images/TileSets/PathAndObjects");
            cursorTexture            = Content.Load <Texture2D>("Images/UI/Cursor");

            // Create the board
            tileManager = new TileManager(20, 15, testLevelTileSheet);
            UI          = new BattleSceneUI();
            UI.LoadContent(Content);

            // Create the character objects after their respective spritesheets have been loaded
            // Each playable characte object will have a UI Select associated with them for either choosing them
            // as the current character or viewing their stats
            mainCharacter = new MainCharacter(testCharacterSpriteSheet);
            mainCharacter.UICharacterSelect.UIClicked += SetCurrentCharacter;
            buttons.Add(mainCharacter.UICharacterSelect);
            tileManager.SetObjectToTilePosition(mainCharacter, new Vector2(0, 0));

            albertEinstein = new AlbertEinstein(einsteinSpriteSheet);
            albertEinstein.UICharacterSelect.UIClicked += SetCurrentCharacter;
            buttons.Add(albertEinstein.UICharacterSelect);
            tileManager.SetObjectToTilePosition(albertEinstein, new Vector2(320, 320));

            jesusChrist = new JesusChrist(jesusSpriteSheet);
            jesusChrist.UICharacterSelect.UIClicked += SetCurrentCharacter;
            buttons.Add(jesusChrist.UICharacterSelect);
            tileManager.SetObjectToTilePosition(jesusChrist, new Vector2(64, 64));

            georgeWashington = new GeorgeWashingon(washingtonSpriteSheet);
            georgeWashington.UICharacterSelect.UIClicked += SetCurrentCharacter;
            buttons.Add(georgeWashington.UICharacterSelect);
            tileManager.SetObjectToTilePosition(georgeWashington, new Vector2(0, 64));

            // party data
            Random initiativeRoll = new Random();

            mainCharacter.Initiative    = initiativeRoll.Next(0, 10);
            jesusChrist.Initiative      = initiativeRoll.Next(0, 10);
            albertEinstein.Initiative   = initiativeRoll.Next(0, 10);
            georgeWashington.Initiative = initiativeRoll.Next(0, 10);

            Console.WriteLine("{0} {1} {2} {3}", mainCharacter.Initiative, jesusChrist.Initiative, albertEinstein.Initiative, georgeWashington.Initiative);

            party.Add(mainCharacter);
            party.Add(jesusChrist);
            party.Add(albertEinstein);
            party.Add(georgeWashington);

            List <Character> sortedList = new List <Character>();

            sortedList.Add(mainCharacter);
            sortedList.Add(jesusChrist);
            sortedList.Add(albertEinstein);
            sortedList.Add(georgeWashington);
            sortedList.Sort((c1, c2) => c1.Initiative.CompareTo(c2.Initiative));

            sortedList.ForEach(c => turnQueue.Enqueue(c));
            currentCharacter = mainCharacter;

            EndTurn();
        }