protected override void OnCharacterAboutToBeSpawned(ECharacterType eType, ref BaseCharacter baseCharacter)
    {
        switch (eType)
        {
        case ECharacterType.enemy_zombie:
        {
            CharacterEnemy enemy = baseCharacter as CharacterEnemy;
            if (null != enemy)
            {
                m_aEnemiesNotAggroed.Add(enemy);

                enemy.gameObject.transform.parent = gameObject.transform;
            }
        }
        break;

        case ECharacterType.none:
        case ECharacterType.player:
        default:
        {
            Assert.IsTrue(false);
        }
        break;
        }
    }
    public void CreateCharacter(ECharacterType characterType, string name, int level)
    {
        BaseCharacter newCharacter = new BaseCharacter();

        switch (characterType)
        {
        case ECharacterType.WARRIOR:
            Warrior newWarrior = gameObject.AddComponent <Warrior>();
            newWarrior.InitializeCharacter(name, level);
            AddCharacter(newWarrior);
            newCharacter = newWarrior;
            break;

        case ECharacterType.ROGUE:
            Rogue newRogue = gameObject.AddComponent <Rogue>();
            newRogue.InitializeCharacter(name, level);
            AddCharacter(newRogue);
            newCharacter = newRogue;
            break;

        case ECharacterType.MAGE:
            Mage newMage = gameObject.AddComponent <Mage>();
            newMage.InitializeCharacter(name, level);
            AddCharacter(newMage);
            newCharacter = newMage;
            break;
        }

        allCharacters.Add(newCharacter);
    }
Exemple #3
0
 protected virtual void InitializeAllyStatController(RTSAllyComponentSpecificFields _specific, RTSAllyComponentsAllCharacterFields _allFields)
 {
     characterType = _specific.CharacterType;
     InitializeCharacterStats();
     RetrieveAllWeaponStats();
     UpdateUnequippedWeaponType();
 }
Exemple #4
0
        protected virtual IEnumerator YieldSave_IGBPI_Values(ECharacterType _cType, List <IGBPIPanelValue> _values)
        {
            Save_IGBPI_Values(_cType, _values);
            yield return(new WaitForSecondsRealtime(0.5f));

            Debug.Log("Finished Saving");
        }
Exemple #5
0
    //TODO EXPAND ON THIS FOR CHARACTER FUNCTIONALITY
    // Update is called once per frame
    public void TBC_InitialiseCharacter()
    {
        animator = GetComponent <Animator>();
        animator.runtimeAnimatorController = character.animatorController;
        currentEffect        = 0;
        this.gameObject.name = character.title;
        //Stats
        characterType = character.characterType;
        hitPoints     = character.hitPoints;
        strength      = character.strength;
        attack        = character.attack;
        agility       = character.agility;
        actionPoints  = character.actionPoints;
        specials      = character.specials;

        foreach (EElement element in character.elementResistance)
        {
            elementalResistance.Add(element);
        }

        foreach (EElement element in character.elementWeakness)
        {
            elementalWeakness.Add(element);
        }
    }
Exemple #6
0
 public void PlaceCharacterOnHexagon(int numberOfPelos, Hexagon hexagon, ECharacterType characterType)
 {
     for (int i = 0; i < numberOfPelos; ++i)
     {
         Vector2 pos = new Vector2();
         pos.x = Random.Range(hexagon.transform.position.x + localOffsetBegin.x, hexagon.transform.position.x + localOffsetEnd.x);
         pos.y = Random.Range(hexagon.transform.position.y + localOffsetBegin.y, hexagon.transform.position.y + localOffsetEnd.y);
         if (characterType == ECharacterType.Medic)
         {
             GameObject medicGO = GameObject.Instantiate(medic);
             medicGO.transform.position = pos;
             medicGO.GetComponent <CharacterControl>().OnCurrentHexagonChanged(hexagon);
             medicGO.GetComponent <CharacterControl>().HexagonManager = GetComponent <HexagonManager>();
             medicInGame.Add(medicGO);
         }
         if (characterType == ECharacterType.Soldier)
         {
             GameObject soldierGO = GameObject.Instantiate(soldier);
             soldierGO.transform.position = pos;
             soldierGO.GetComponent <CharacterControl>().OnCurrentHexagonChanged(hexagon);
             soldierGO.GetComponent <CharacterControl>().HexagonManager = GetComponent <HexagonManager>();
             medicInGame.Add(soldierGO);
         }
     }
 }
        private void check(ECharacterType type)
        {
            HittableCharacter c = upgrader.spawn(type);

            if (c.getSpawnCost() < minCost)
            {
                minCost     = c.getSpawnCost();
                cheapChoice = type;
            }
            if (c.spawnAttribute.speedFactor >= maxSpeed)
            {
                maxSpeed     = c.spawnAttribute.speedFactor;
                speedyChoice = type;
            }
            if (c.spawnAttribute.meleeFactor >= maxMelee)
            {
                maxMelee    = c.spawnAttribute.meleeFactor;
                meleeChoice = type;
            }
            if (c.spawnAttribute.rangeFactor >= maxRange)
            {
                maxRange    = c.spawnAttribute.rangeFactor;
                rangeChoice = type;
            }
            if (c.spawnAttribute.aoeFactor >= maxAoe)
            {
                maxAoe    = c.spawnAttribute.aoeFactor;
                aoeChoice = type;
            }
        }
Exemple #8
0
 public Character CreateCharacter(string name, ECharacterType characterType)
 {
     if (!_characterFactories.ContainsKey(characterType))
     {
         throw new ArgumentException($"Character Type is not implemented: {characterType}");
     }
     return(_characterFactories[characterType].Create(name));
 }
 public AI_ParamCharacter(int id, ECharacterType type, Vector3 position, Vector3 direction, Vector3 velocity, bool visible)
 {
     this.CharacterID   = id;
     this.CharacterType = type;
     this.Direction     = direction;
     this.Position      = position;
     this.Velocity      = velocity;
     this.VisibleByAI   = visible;
 }
 public CharacterObject(int _playerId, ECharacterType _characterType, int _hp, int _regen, int _speed, ETeam _teamId, Vector2 _position, EObjectDirection _direction) :
     base(_hp, _regen, _teamId, _position)
 {
     playerId      = _playerId;
     direction     = _direction;
     characterType = _characterType;
     speed         = _speed;
     abilities     = CreateAbilities();
 }
Exemple #11
0
        public virtual List <IGBPIPanelValue> Load_IGBPI_PanelValues(ECharacterType _cType)
        {
            CharacterTactics _tactics;

            if (!isIGBPISavingPermitted(_cType, out _tactics))
            {
                return(null);
            }
            return(ValidateIGBPIValues(_tactics.Tactics));
        }
Exemple #12
0
 public CharacterStateData(int _id, int _playerId, ECharacterType _type, ETeam _teamId, Vector2 _position, EObjectDirection _direction, int _hp, int _speed)
 {
     id        = _id;
     playerId  = _playerId;
     type      = _type;
     teamId    = _teamId;
     position  = _position;
     direction = _direction;
     hp        = _hp;
     speed     = _speed;
 }
Exemple #13
0
 public CharacterStateData(Packet _packet)
 {
     id        = _packet.ReadInt();
     playerId  = _packet.ReadInt();
     type      = (ECharacterType)_packet.ReadInt();
     position  = _packet.ReadVector2();
     direction = (EObjectDirection)_packet.ReadInt();
     teamId    = (ETeam)_packet.ReadInt();
     hp        = _packet.ReadInt();
     speed     = _packet.ReadInt();
 }
 public AI_Character(int character_id, ECharacterType character_type)
 {
     this.CharacterID    = character_id;
     this.CharacterType  = character_type;
     this.CurrentAction  = null;
     this.PreviousAction = null;
     this.Direction      = Vector3.zero;
     this.Position       = Vector3.zero;
     this.Velocity       = Vector3.zero;
     this.LastSeenTime   = 0.0f;
     this.IsAlive        = false;
 }
Exemple #15
0
 /// <summary>
 ///  Used to retrieve an Anonymous Character's Tactics, that will not update
 ///  from a specific character instance.
 /// </summary>
 /// <param name="_cType"></param>
 /// <returns></returns>
 public virtual CharacterTactics RetrieveAnonymousCharacterTactics(ECharacterType _cType)
 {
     CheckForDictionaryInit();
     if (CharacterTacticsDictionary.ContainsKey(_cType))
     {
         return(CharacterTacticsDictionary[_cType]);
     }
     Debug.Log("Character Tactics For Type: " + _cType.ToString() + " could not be found");
     return(new CharacterTactics
     {
         CharacterType = ECharacterType.NoCharacterType
     });
 }
Exemple #16
0
    public static GameObject LoadCharacter(string name, ECharacterType type)
    {
        switch (type)
        {
        case ECharacterType.Enemy:
            name = "Character/EnemyCharacter/" + name;
            break;

        case ECharacterType.Player:
            name = "Character/PlayerCharacter/" + name;
            break;
        }

        return(Resources.Load <GameObject>(name));
    }
Exemple #17
0
        public HittableCharacter spawn(ECharacterType character)
        {
            switch (character)
            {
            case ECharacterType.MELEE:
                return((HittableCharacter)Activator.CreateInstance(meleeCharacter));

            case ECharacterType.RANGED:
                return((HittableCharacter)Activator.CreateInstance(rangedCharacter));

            case ECharacterType.SPECIAL:
                return((HittableCharacter)Activator.CreateInstance(specialCharacter));
            }
            return((HittableCharacter)Activator.CreateInstance(meleeCharacter));
        }
Exemple #18
0
 protected virtual bool isIGBPISavingPermitted(ECharacterType _cType, out CharacterTactics _tactics)
 {
     _tactics = GetTacticsFromCharacter(_cType);
     if (_tactics.CharacterType == ECharacterType.NoCharacterType)
     {
         Debug.LogError("No IGBPI Data Object on Save Manager For Character Type " + _tactics.CharacterType.ToString());
         return(false);
     }
     if (dataHandler == null)
     {
         Debug.LogError("No Data Handler could be found.");
         return(false);
     }
     return(true);
 }
    public bool SpawnCharacters(ECharacterType eType, int iCharactersCount, bool bSpawnOnServer, ref List <BaseCharacter> aBaseCharacters)
    {
        aBaseCharacters.Clear();

        for (int iCharacterIndex = 0; iCharacterIndex < iCharactersCount; ++iCharacterIndex)
        {
            //
            // Retrieve transform to random spawn location
            Vector3    vPosition = new Vector3();
            Quaternion qOrn      = new Quaternion();
            if (!GetSpawnParameters(ref vPosition, ref qOrn))
            {
                return(false);
            }

            //
            // Instantiate prefab
            GameObject prefab = m_mapCharacterToPrefab[(int)(eType)];
            if (null == prefab)
            {
                Debug.Log("Could not spawn character type '" + eType + "' from manager '" + m_strName + "'");
                continue;
            }

            GameObject    newCharacterObject = Instantiate(prefab, vPosition, qOrn);
            BaseCharacter character          = newCharacterObject.GetComponent <BaseCharacter>();
            character.m_characterManager = this;
            character.SetCharacterType(eType);

            //
            // Notify sub-class
            OnCharacterAboutToBeSpawned(eType, ref character);

            //
            // Spawn character on server
            if (bSpawnOnServer)
            {
                NetworkServer.Spawn(newCharacterObject);
            }

            //
            // Add character to list
            aBaseCharacters.Add(character);
            m_aCharacters.Add(character);
        }

        return(true);
    }
Exemple #20
0
        public virtual void Save_IGBPI_PanelValues(ECharacterType _cType, List <IGBPI_UI_Panel> _panels)
        {
            CharacterTactics _tactics;

            if (!isIGBPISavingPermitted(_cType, out _tactics))
            {
                return;
            }
            List <IGBPIPanelValue> _saveValues = new List <IGBPIPanelValue>();

            foreach (var _panel in _panels)
            {
                _saveValues.Add(new IGBPIPanelValue(
                                    _panel.orderText.text,
                                    _panel.conditionText.text,
                                    _panel.actionText.text
                                    ));
            }
            Save_IGBPI_Values(_cType, _saveValues);
        }
Exemple #21
0
        protected virtual void Save_IGBPI_Values(ECharacterType _cType, List <IGBPIPanelValue> _values)
        {
            CharacterTactics _tactics;

            if (!isIGBPISavingPermitted(_cType, out _tactics))
            {
                return;
            }

            List <CharacterTactics> _allCharacterTactics = LoadCharacterTacticsList();
            int _indexOf = -1;
            CharacterTactics _characterToChange = new CharacterTactics
            {
                CharacterName = "",
                CharacterType = ECharacterType.NoCharacterType,
                Tactics       = new List <IGBPIPanelValue>()
            };

            foreach (var _checkCharacter in _allCharacterTactics)
            {
                if (_cType != ECharacterType.NoCharacterType &&
                    _checkCharacter.CharacterType == _cType)
                {
                    _indexOf = _allCharacterTactics.IndexOf(_checkCharacter);
                    _characterToChange.CharacterName = _checkCharacter.CharacterName;
                    _characterToChange.CharacterType = _checkCharacter.CharacterType;
                    _characterToChange.Tactics       = ValidateIGBPIValues(_values);
                }
            }

            if (_characterToChange.CharacterType != ECharacterType.NoCharacterType &&
                _indexOf != -1)
            {
                _allCharacterTactics[_indexOf] = _characterToChange;
                statHandler.UpdateTacticsDictionary(_allCharacterTactics);
                SaveXMLTactics(_allCharacterTactics);
            }
        }
Exemple #22
0
 /// <summary>
 ///  Used to retrieve an Anonymous Character's Stats, that may update
 ///  from a specific character instance if the instance is the player's
 ///  general partymembers.
 /// </summary>
 /// <param name="_ally"></param>
 /// <param name="_cType"></param>
 /// <returns></returns>
 public virtual CharacterStats RetrieveCharacterStats(AllyMember _ally, ECharacterType _cType)
 {
     CheckForDictionaryInit();
     return(RetrieveAnonymousCharacterStats(_cType));
 }
 public static void PushCharacter(int id, ECharacterType type, Vector3 position, Vector3 direction, Vector3 velocity)
 {
     PushCharacter(id, type, position, direction, velocity, true);
 }
 /// <summary>
 /// [Game thread] Adds information about the current status of a character.
 /// </summary>
 /// <param name="id">ID of the character</param>
 /// <param name="type">Type of the character (refer to the ECharacterType enum for valid character types)</param>
 /// <param name="position">Current position of the character</param>
 /// <param name="direction">Current direction the character is facing</param>
 /// <param name="velocity">Current velocity of the character</param>
 /// <param name="visible">Is the character visible for the AI? (optional, true by default)</param>
 public static void PushCharacter(int id, ECharacterType type, Vector3 position, Vector3 direction, Vector3 velocity, bool visible)
 {
     Instance.Characters.Add(new AI_ParamCharacter(id, type, position, direction, velocity, visible));
 }
 protected override void OnCharacterAboutToBeSpawned(ECharacterType eType, ref BaseCharacter baseCharacter)
 {
     m_aPlayersAlive.Add(baseCharacter);
 }
Exemple #26
0
 protected virtual CharacterTactics GetTacticsFromCharacter(ECharacterType _cType)
 {
     return(statHandler.RetrieveAnonymousCharacterTactics(_cType));
 }
 protected abstract void OnCharacterAboutToBeSpawned(ECharacterType eType, ref BaseCharacter baseCharacter);
Exemple #28
0
 protected virtual List <IGBPIPanelValue> GetPanelValuesFromCharacter(ECharacterType _cType)
 {
     return(GetTacticsFromCharacter(_cType).Tactics);
 }
 public void SetCharacterType(ECharacterType eType)
 {
     m_eType = eType;
 }
Exemple #30
0
 /** accessable methods from the buttons */
 public void spawn(ECharacterType type)
 {
     spawn(upgrader.spawn(type));
 }