Exemplo n.º 1
0
    public void InitializeCharacterPanel()
    {
        _battleSystem = GetComponentInParent <BattleSystem>();
        _battleField  = FindObjectOfType <BattleField>();
        _targetIcon   = FindObjectOfType <TargetIcon>();

        foreach (PlayerBattlePlacement pb in _battleField._playerBattlePlacement)
        {
            if (pb._battlePosition == _characterPanelNumber)
            {
                _myCharacter = pb._mycharacterBattler;
            }
        }

        if (_myCharacter == null)
        {
            return;                       /// Stop the Initialization
        }
        _characterIcon      = _myCharacter.GetComponentInChildren <CharacterIcon>();
        _characterAbilities = _myCharacter.GetComponent <CharacterAbilities>();

        _targetManager  = new TargetManager(_battleField._playerBattlePlacement, _battleField._enemyBattlePlacement, _characterAbilities, _targetIcon);
        _uiPanelChanger = GetComponent <UIPanelChanger>();

        _magicPanelManager = GetComponentInChildren <MagicPanelManager>();
        _magicPanelManager.InitializeMagicPanels(_characterAbilities._classSkills);

        _isInitialized = true;
    }
Exemplo n.º 2
0
 private void Awake()
 {
     _character          = GetComponent <Character>();
     _characterAbilities = GetComponent <CharacterAbilities>();
     _battleField        = FindObjectOfType <BattleField>();
     _targetIcon         = FindObjectOfType <TargetIcon>();
     _battleSystem       = FindObjectOfType <BattleSystem>();
 }
Exemplo n.º 3
0
    private void Start()
    {
        m_KeyNum      = _Locks.Count;
        _RebirthPoint = new Vector3(transform.position.x, transform.position.y + 10, 1);
        _myAncient    = GetComponent <AncientItem>();

        CharacterAbilities.Add_OnTimeLock(ResetAncientState);
    }
Exemplo n.º 4
0
        public void AddPoints_NegativeAmount_ThrowsException()
        {
            // Assign
            var abilityScores = new CharacterAbilities();

            // Act
            // Assert
            Assert.Throws<ArgumentException>(() => abilityScores.AddPoints(-10));
        }
Exemplo n.º 5
0
        public void Constructor_NoScores_UnusedPointsZero()
        {
            // Assign
            // Act
            var abilityScores = new CharacterAbilities();

            // Assert
            Assert.Equal(0, abilityScores.UnusedPoints);
        }
Exemplo n.º 6
0
    public TargetManager(BattlePlacement[] allyBattlePlacements, BattlePlacement[] enemyBattlePlacements, CharacterAbilities characterAbilities, TargetIcon targetIcon)
    {
        _characterAbilities = characterAbilities;
        _targetIcon         = targetIcon;

        _allyBattlePlacements  = allyBattlePlacements;
        _enemyBattlePlacements = enemyBattlePlacements;
        ResetTargets();
    }
Exemplo n.º 7
0
        public void Constructor_AbilityScoreNotGiven_SetsAbilityToDefault()
        {
            // Assign
            var abilities = new Dictionary<AbilityType, int> { { AbilityType.Strength, 18 } };

            // Act
            var abilityScores = new CharacterAbilities(abilities);

            // Assert
            Assert.Equal(10, abilityScores.Wisdom);
        }
Exemplo n.º 8
0
        public void AddPoints_Zero_DoesNotChangeUnusedPoints()
        {
            // Assign
            var abilityScores = new CharacterAbilities();

            // Act
            abilityScores.AddPoints(0);

            // Assert
            Assert.Equal(0, abilityScores.UnusedPoints);
        }
Exemplo n.º 9
0
        public void AddPoints_PositiveAmount_IncreasesUnusedPoints()
        {
            // Assign
            var abilityScores = new CharacterAbilities();

            // Act
            abilityScores.AddPoints(10);

            // Assert
            Assert.Equal(10, abilityScores.UnusedPoints);
        }
Exemplo n.º 10
0
        public DefaultCharacter(Race race, ClassType classType, Dictionary<AbilityType, int> abilityScores, IModifierProvider modifierProvider)
            : this(modifierProvider)
        {
            Race = race;
            InitializeProperties();
            _abilities = new CharacterAbilities(abilityScores);

            var characterClass = ClassProvider.GetNewClass(classType, _modifierProvider);
            Classes.Add(classType, characterClass);
            // Once all the properties are set, OnCreation can be called, which will process all modifiers for this character/class/race
            OnCreation(classType);
        }
Exemplo n.º 11
0
    public virtual void Awake()
    {
        // must be on Awake because of Initialization Timing
        _characterStats = new CharacterStats();
        _characterStats.GetDataFromCharacterClass(_characterClass);

        _characterHPMPManager = GetComponent <CharacterHPMPManager>();
        _characterHPMPManager.InitializeLinkCharacter(this);

        _characterLevelManager = GetComponent <CharacterLevelManager>();
        _characterLevelManager?.Initialize(this);

        _battleAI           = GetComponent <BattleAI>();
        _characterAbilities = GetComponent <CharacterAbilities>();
        _characterAbilities?.InitializeCharacterAbilities();
        _characterCamera         = GetComponentInChildren <CharacterCamera>();
        _characterBattleAnimator = GetComponentInChildren <CharacterBattleAnimator>();
    }
        private CharacterAbilities GenerateCharacterAbilities(CharacterClass characterClass, CharacterRace characterRace)
        {
            CharacterAbilities characterAbilities = CharacterAbilities.None;

            if (characterRace == CharacterRace.Dwarf)
            {
                characterAbilities |= CharacterAbilities.Darkvision;
                characterAbilities |= CharacterAbilities.DetectConstruction;
            }
            if (characterRace == CharacterRace.Elf)
            {
                characterAbilities |= CharacterAbilities.Darkvision;
                characterAbilities |= CharacterAbilities.GhoulImmune;
                characterAbilities |= CharacterAbilities.DetectSecretDoors;
                characterAbilities |= CharacterAbilities.ReduceSurprise;
            }
            if (characterRace == CharacterRace.Halfling)
            {
                characterAbilities |= CharacterAbilities.HalflingACBonus;
                characterAbilities |= CharacterAbilities.HalflingAttackBonus;
                characterAbilities |= CharacterAbilities.HalflingHiding;
                characterAbilities |= CharacterAbilities.HalflingInitiative;
            }
            if (characterRace == CharacterRace.Human)
            {
                characterAbilities |= CharacterAbilities.HumanXPBonus;
            }
            if (characterClass == CharacterClass.Thief)
            {
                characterAbilities |= CharacterAbilities.ThiefSkills;
            }
            if (characterClass == CharacterClass.Cleric)
            {
                characterAbilities |= CharacterAbilities.TurnUndead;
            }

            return(characterAbilities);
        }
Exemplo n.º 13
0
        public void Constructor_WithScores_UnusedPointsZero()
        {
            // Assign
            var abilities = new Dictionary<AbilityType, int> { { AbilityType.Strength, 18 } };

            // Act
            var abilityScores = new CharacterAbilities(abilities);

            // Assert
            Assert.Equal(0, abilityScores.UnusedPoints);
        }
Exemplo n.º 14
0
 void Awake()
 {
     _battleSystem       = FindObjectOfType <BattleSystem>();
     _characterAbilities = GetComponentInParent <CharacterAbilities>();
 }
Exemplo n.º 15
0
 // Start is called before the first frame update
 void Start()
 {
     instance          = this;
     m_CurRebitrhPoint = transform.position;
 }
Exemplo n.º 16
0
 public virtual void ActivateSkill(CharacterAbilities user)
 {
 }
Exemplo n.º 17
0
 private void Start()
 {
     CharacterAbilities.Add_OnTimeLock(ResetItemState);
 }
Exemplo n.º 18
0
 public virtual void Start()
 {
     player = GameObject.Find("Player").GetComponent <CharacterAbilities>();
 }
Exemplo n.º 19
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);

            Vector2 position   = new Vector2();
            Vector2 stringSize = new Vector2();
            string  text;
            float   maxLength = 0.0f;

            text       = playerCharacter.Name;
            stringSize = spriteFont.MeasureString(text);

            position.Y = imagePosition.Y + 12;
            position.X = imagePosition.X + (image.Width - stringSize.X) / 2;

            DrawText(text, position);

            position.Y += 10;

            string[]           abilityWords = Enum.GetNames(typeof(Abilities));
            CharacterAbilities abilities    = playerCharacter.Abilities;

            int[] scores = new int[abilities.Length];

            for (int i = 0; i < scores.Length; i++)
            {
                scores[i] = abilities[i];
            }

            foreach (string s in abilityWords)
            {
                text       = s + ": ";
                stringSize = spriteFont.MeasureString(text);
                if (stringSize.X > maxLength)
                {
                    maxLength = stringSize.X;
                }
            }

            for (int i = 0; i < abilities.Length; i++)
            {
                text = abilityWords[i] + ": ";

                position.Y += spriteFont.LineSpacing;
                position.X  = imagePosition.X + 17;

                DrawText(text, position);

                position.X += maxLength;

                text = scores[i].ToString();
                DrawText(text, position);
            }


            string[] statNames =
            {
                "Class: ",
                "Level: ",
                "HP: ",
                "SP: ",
                "XP: ",
                "Gold: "
            };
            string[] statValues =
            {
                playerCharacter.ClassName,
                playerCharacter.PlayerLevel.ToString(),
                playerCharacter.HitPointsCurrent.ToString() + "/" +
                playerCharacter.HitPointsMax.ToString(),
                playerCharacter.SpellPointsCurrent.ToString() + "/" +
                playerCharacter.SpellPointsMax.ToString(),
                playerCharacter.Experience.ToString(),
                playerCharacter.Gold.ToString()
            };

            maxLength = 0.0f;

            foreach (string s in statNames)
            {
                stringSize = spriteFont.MeasureString(s);
                if (stringSize.X > maxLength)
                {
                    maxLength = stringSize.X;
                }
            }

            position.Y = imagePosition.Y + 20;

            for (int i = 0; i < statNames.Length; i++)
            {
                position.Y += spriteFont.LineSpacing;
                position.X  = imagePosition.X + (image.Width / 2) + 8;

                text = statNames[i];
                DrawText(text, position);

                position.X += maxLength;

                text = statValues[i].ToString();
                DrawText(text, position);
            }
        }