Ejemplo n.º 1
0
        private void UpdateEnemy(DWEnemy enemy)
        {
            if (EnemyPanel.InvokeRequired)
            {
                var d = new UpdateEnemyDelegate(UpdateEnemy);
                EnemyPanel.Invoke(d, new object[] { enemy });
            }
            else
            {
                // update enemy image
                EnemyPanelPictureBox.Image = enemy.GetImage();

                // clear enemy stats table
                while (EnemyStatsTable.Controls.Count > 0)
                {
                    EnemyStatsTable.Controls[0].Dispose();
                }
                while (EnemyInfoTable.Controls.Count > 0)
                {
                    EnemyInfoTable.Controls[0].Dispose();
                }

                // add enemy stats to table
                string[,] stats = enemy.GetBattleInfo(Hero);
                for (int i = 0; i < stats.GetLength(0); i++)
                {
                    string name  = stats[i, 0];
                    string value = stats[i, 1];

                    if (i == 0)
                    {
                        CombatPanel.Title = name;
                    }
                    else
                    {
                        TableLayoutPanel table    = i < 6 ? EnemyInfoTable : EnemyStatsTable;
                        bool             isHeader = value == "";
                        int row = i < 6 ? i - 1 : i - 6;

                        DWLabel nameLabel = new DWLabel {
                            TextAlign = ContentAlignment.MiddleLeft
                        };
                        table.Controls.Add(nameLabel, 0, row);
                        nameLabel.FitText(name, true, isHeader ? FontStyle.Bold : FontStyle.Regular);

                        DWLabel valueLabel = new DWLabel {
                            TextAlign = ContentAlignment.MiddleRight
                        };
                        table.Controls.Add(valueLabel, 1, row);
                        valueLabel.FitText(value, true);
                    }
                }
            }
        }
Ejemplo n.º 2
0
    void Awake()
    {
        Debug.Log("Game Starting");

        players     = new List <Character>();
        enemies     = new List <Character>();
        battleQueue = null;

        /* starting up the battle heros*/
        Debug.Log("Setting up Characters");
        monk      = Instantiate(monk, new Vector3(4.25f * scale, 1f * scale, 0), Quaternion.identity);
        swordsmen = Instantiate(swordsmen, new Vector3(4.5f * scale, 0f, 0), Quaternion.identity);

        leafy = Instantiate(leafy, new Vector3(-4f * scale, 0f, 0), Quaternion.identity);

        players.Add(monk);
        players.Add(swordsmen);

        enemies.Add(leafy);

        addToQueue(monk);
        addToQueue(swordsmen);
        addToQueue(leafy);

        //points the queue pointer to the first on in the queue
        battleQueueController = battleQueue;

        //setting up the cursor
        Debug.Log("Setting up hero cursor");
        heroCursorDelay        = 0.25f;
        lastCursorMove         = Time.time;
        currentHeroOptionIndex = 0;

        //setting up the enemy cursor
        Debug.Log("Setting up the enemy cursor");
        targetCursorDelay = 0.25f;
        lastCursorMove    = Time.time;

        //sets the first person in the queue as the person with the first turn
        battleQueueController.getCharacterRef().setActive(true);
        turn = battleQueueController.getCharacterRef().getType();

        // Menu Set up
        plyPanel = Instantiate(plyPanel);
        plyPanel.setUp(canvas, players.Count, players);
        plyPanel.setActivity(true);

        enemyPanel = Instantiate(enemyPanel);
        string[] enemyListNames = new string[enemies.Count];

        for (int count = 0; count < enemies.Count; count++)
        {
            enemyListNames[count] = enemies[count].charName;
        }

        enemyPanel.setUp(canvas, enemies.Count, enemyListNames);
        enemyPanel.setActivity(true);
        enemyPanel.setGlow(false);

        monk.setShitUp(canvas);
        swordsmen.setShitUp(canvas);

        // It it's the players turn first, the cursor will point to the player
        if (turn == TYPE.PLAYER)
        {
            setUpCursor(battleQueueController.getCharacterRef(), true, 1.5f * scale, 0.5f * scale);
            plyPanel.changeCurrentActivePlayer(players.IndexOf(battleQueueController.getCharacterRef()), true);
        }

        setUpCursor(enemies[0], false, 1.5f * scale, 0.5f * scale);//sets up the target cursor temporarily
        targetCursor.setActivity(false);

        selectedCommand = Command.NONE;
        inputWaiter     = Command.NONE;
    }