示例#1
0
        /// <summary>
        ///     Regenerates (updates) the <seealso cref="actions"/> from <seealso cref="actionClasses"/>
        /// </summary>
        public void RegenerateActions()
        {
            this.actions = new BattleAction[this.actionClasses.Length];

            for (int i = 0; i < this.actionClasses.Length; i++)
            {
                this.actions[i] = BattleAction.GetBattleAction(this.actionClasses[i], this);
            }
        }
示例#2
0
        /// <summary>
        ///     Sets all values.
        /// </summary>
        public void Setup()
        {
            if (this.battleDriver == null || this.pauseMenu == null)
            {
                throw new RPGException(RPGException.Cause.MenuMissingComponent);
            }

            this.memberName.text = string.Format(PartyMemberDisplay.LabelFormat, this.battleDriver.BattleName, this.battleDriver.Level);
            this.battleDriver.RecalculateStats();

            PlayerDriver player = this.battleDriver.entityDriver as PlayerDriver;

            // Dismiss Button
            if (PlayerDriver.Party.Count > 1)
            {
                this.dismissalButton.onClick.AddListener(delegate
                {
                    player.LeaveParty();

                    this.pauseMenu.CreateMenu();
                });
            }
            else
            {
                this.dismissalButton.interactable = false;
            }

            int partyIndex = PlayerDriver.Party.IndexOf(player);

            // Move up button
            if (partyIndex > 0)
            {
                this.moveUpButton.onClick.AddListener(delegate
                {
                    PlayerDriver.Party.Move(partyIndex, partyIndex - 1);

                    this.pauseMenu.CreateMenu();
                });
            }
            else
            {
                this.moveUpButton.interactable = false;
            }

            // Move down button
            if (partyIndex < PlayerDriver.Party.Count - 1)
            {
                this.moveDownButton.onClick.AddListener(delegate
                {
                    PlayerDriver.Party.Move(partyIndex, partyIndex + 1);

                    this.pauseMenu.CreateMenu();
                });
            }
            else
            {
                this.moveDownButton.interactable = false;
            }

            // Statistics
            this.statusTextLeft.text = PartyMemberDisplay.StatusLeft;

            this.statusTextRight.text = string.Format(
                PartyMemberDisplay.StatusRightFormat,
                this.battleDriver.CurrentHealth,
                this.battleDriver.MaximumHealth,
                this.battleDriver.PhysicalDamage,
                this.battleDriver.MagicalDamage,
                this.battleDriver.Defense,
                this.battleDriver.TurnSpeed);

            // Actions
            string actionText = string.Empty;

            foreach (BattleAction.ActionClass actionClass in this.battleDriver.actionClasses)
            {
                if (actionClass != BattleAction.ActionClass.NoAction)
                {
                    BattleAction action = BattleAction.GetBattleAction(actionClass, this.battleDriver);
                    actionText += (actionText.Length > 0 ? "\n" : string.Empty) + string.Format(PartyMemberDisplay.ActionFormat, action.Name, action.Description);
                }
            }

            this.actionText.text = actionText;
        }