Esempio n. 1
0
            public static int Health(Unit.Type type)
            {
                if (type == Unit.Type.Archer)
                {
                    return(10);
                }
                if (type == Unit.Type.Dragon)
                {
                    return(100);
                }
                if (type == Unit.Type.Infantry)
                {
                    return(10);
                }
                if (type == Unit.Type.Knight)
                {
                    return(35);
                }
                if (type == Unit.Type.Wizard)
                {
                    return(30);
                }

                throw new Exception($"Invalid unit type: {type}.");
            }
Esempio n. 2
0
            public static Skills Parameters(Unit.Type type)
            {
                if (type == Unit.Type.Archer)
                {
                    return(new Skills(damage: 7, defence: 7, speed: 4));
                }
                if (type == Unit.Type.Dragon)
                {
                    return(new Skills(damage: 10, defence: 10, speed: 10));
                }
                if (type == Unit.Type.Infantry)
                {
                    return(new Skills(damage: 5, defence: 5, speed: 5));
                }
                if (type == Unit.Type.Knight)
                {
                    return(new Skills(damage: 8, defence: 8, speed: 6));
                }
                if (type == Unit.Type.Wizard)
                {
                    return(new Skills(damage: 6, defence: 5, speed: 3));
                }

                throw new Exception($"Invalid unit type: {type}.");
            }
Esempio n. 3
0
 public Detachment(Unit.Type type, int amount)
 {
     Type   = type;
     Amount = amount;
     Health = Amount * Settings.Units.Health(Type);
     Speed  = Settings.Units.Parameters(Type).Speed;
 }
Esempio n. 4
0
 public static void LevelUpCost(Unit.Type type)
 {
     CreateAndOrderUnit.costLevel[(int)type]++;
     foreach (var item in allCreateAndOrder)
     {
         item.unitCostText.text = item.Cost.ToString();
     }
 }
Esempio n. 5
0
 public void SetUnit()
 {
     if (m_texture)
     {
         type = (Unit.Type) int.Parse(m_texture.name.Split(new char[2] {
             '[', ']'
         })[1]);
         data = AssetDatabase.LoadAssetAtPath <Unit.Database>("Assets/_iLYuSha_Mod/Base/Warfare/Unit/Database.asset").units[type];
     }
     else
     {
         type = Unit.Type.None;
         data = null;
     }
 }
    public void Load(ICharacter character, Unit.Type type)
    {
        switch (type)
        {
        case global::Unit.Type.PLAYER:
            unit = new PlayerUnit();
            break;

        case global::Unit.Type.ENEMY:
            unit = new EnemyUnit();
            break;
        }
        unit.Load(character.Stats.Clone());
        unit.Init();
    }
Esempio n. 7
0
        public static Skills Parameters(Unit.Type type)
        {
            if (type == Unit.Type.Attack)
            {
                return(new Skills(attack: 5, defence: 1, speed: 2));
            }
            if (type == Unit.Type.Defence)
            {
                return(new Skills(attack: 2, defence: 4, speed: 2));
            }
            if (type == Unit.Type.Speed)
            {
                return(new Skills(attack: 3, defence: 1, speed: 4));
            }

            throw new Exception($"Invalid unit type: {type}.");
        }
Esempio n. 8
0
    /// <summary>
    /// Calculates the attack value against an enemy unit type
    /// </summary>
    /// <param name="enemyUnitType">The enemy unit type which the attack value should be calculated for.</param>
    /// <param name="armorUnitType">The enemy unit armor type which the attack value should be calculated for.</param>
    /// <returns>Returns the attack value/the damage calculated</returns>
    public int GetAttack(Unit.Type enemyUnitType, Unit.ArmorType armorUnitType)
    {
        var returnDamage = this.attack + Unit.OtherBoostLevel[this.Level] + Unit.OtherBoostLevel[Unit.ATKGroupLevel[(int)this.UnitType]];

        returnDamage += Passives.GetAbsolutPassive(this.UnitType, Passives.Value.ATTACK);
        returnDamage  = (int)(returnDamage * Passives.GetPassive(this.UnitType, Passives.Value.ATTACK));

        returnDamage += Passives.GetAbsolutPassiveArmortype(this.ArmorTypeUnit, Passives.Value.ATTACK);
        returnDamage  = (int)(returnDamage * Passives.GetPassiveArmortype(this.ArmorTypeUnit, Passives.Value.ATTACK));

        returnDamage += Passives.GetAbsolutPassiveAgainstType(enemyUnitType, Passives.Value.ATTACK);
        returnDamage  = (int)(returnDamage * Passives.GetPassiveAgainstType(enemyUnitType, Passives.Value.ATTACK));

        returnDamage += Passives.GetAbsolutPassiveAgainstArmortype(armorUnitType, Passives.Value.ATTACK);
        returnDamage  = (int)(returnDamage * Passives.GetPassiveAgainstArmortype(armorUnitType, Passives.Value.ATTACK));

        return(returnDamage);
    }
Esempio n. 9
0
    public static int GenerateUnit(Unit.Type _type, Player.Type _info, bool _active = true)
    {
        Unit unit;

        switch (_type)
        {
        case Unit.Type.KNIGHT:
            unit = GameObject.Instantiate(Resources.Load <Unit>("Prefabs/Knight"));
            break;

        case Unit.Type.ARCHER:
            unit = GameObject.Instantiate(Resources.Load <Unit>("Prefabs/Archer"));
            break;

        case Unit.Type.WARHOUND:
            unit = GameObject.Instantiate(Resources.Load <Unit>("Prefabs/Warhound"));
            break;

        default:
            Debug.Log("ERROR: Unit type not found");
            return(-1);
        }

        switch (_info)
        {
        case Player.Type.PLAYER1:
            unit.FaceDirection(WarforgedMonoBehaviour.Direction.RIGHT);
            break;

        case Player.Type.PLAYER2:
            unit.FaceDirection(WarforgedMonoBehaviour.Direction.LEFT);
            break;

        default:
            Debug.Log("ERROR: Unit owner unassigned at generation");
            break;
        }
        unit.SetOwner(_info);
        unit.InitializeVariables();
        unit.gameObject.SetActive(_active);
        return(UnitManager.AddUnit(unit));
    }
Esempio n. 10
0
    private void LoadUnits(List <Character.ID> charIDs, Unit.Type type)
    {
        foreach (Character.ID id in charIDs)
        {
            ICharacter           character           = PersistentData.Instance.Characters.Get(id);
            GameObject           characterObject     = GameObject.Instantiate <GameObject>(Resources.Load <GameObject>(string.Format("{0}{1}", Character.ResourcePath, id)), transform);
            ICharacterController characterController = characterObject.GetComponent <CharacterController>();
            switch (type)
            {
            case Unit.Type.PLAYER:
                playerUnits.Add(characterController);
                characterObject.transform.position = GetRandomPointInArea(playerSpawnArea);
                break;

            case Unit.Type.ENEMY:
                enemyUnits.Add(characterController);
                characterObject.transform.position = GetRandomPointInArea(enemySpawnArea);
                break;
            }
            characterController.Load(character, type);
        }
    }
Esempio n. 11
0
 public MissionGoal(GoalTypes goalType, Unit.Type typeRestriction)
 {
     this.goalType        = goalType;
     this.typeRestriction = typeRestriction;
 }
Esempio n. 12
0
 /// <summary>
 /// Gets Bonus stat for single unit (percentage)
 /// </summary>
 /// <param name="type">The type of the unit to get the effect for</param>
 /// <param name="whichValue">Which value to get the effect for</param>
 /// <returns>Value of the bonus (1.0f means no buff or nerf)</returns>
 public static float GetPassive(Unit.Type type, Value whichValue)
 {
     return(skillValues[(int)type, (int)whichValue]);
 }
Esempio n. 13
0
 /// <summary>
 /// Gets Bonus stat for single unit (absolut)
 /// </summary>
 /// <param name="type">The type of the unit to get the effect for</param>
 /// <param name="whichValue">Which value to get the effect for</param>
 /// <returns>Value of the bonus (0 means no buff or nerf)</returns>
 public static int GetAbsolutPassive(Unit.Type type, Value whichValue)
 {
     return(skillValuesAbsolut[(int)type, (int)whichValue]);
 }
Esempio n. 14
0
 public void DeleteKey(Unit.Type key)
 {
     units.Remove(key);
 }
Esempio n. 15
0
 public void Add(Unit.Type type, int amount) =>
 _units[type] += amount;
Esempio n. 16
0
 /// <summary>
 /// Sets Bonus stat for single unit (absolut)
 /// </summary>
 /// <param name="type">Type of the unit to grant the bonus to</param>
 /// <param name="whichValue">Which value to apply the buff to</param>
 /// <param name="valueToSetTo">Value to set the bonus to (0 means no buff or nerf)</param>
 public static void SetAbsolutPassive(Unit.Type type, Value whichValue, int valueToSetTo)
 {
     skillValuesAbsolut[(int)type, (int)whichValue] = valueToSetTo;
 }
Esempio n. 17
0
    // Passiv Buffs & Nerfs

    /// <summary>
    /// Sets Bonus stat for single unit (percentage)
    /// </summary>
    /// <param name="type">Type of the unit to grant the bonus to</param>
    /// <param name="whichValue">Which value to apply the buff to</param>
    /// <param name="valueToSetTo">Value to set the bonus to (1.0f means no buff or nerf)</param>
    public static void SetPassive(Unit.Type type, Value whichValue, float valueToSetTo)
    {
        skillValues[(int)type, (int)whichValue] = valueToSetTo;
    }
Esempio n. 18
0
 /// <summary>
 /// Gets Bonus stat against a specific unit type (absolut)
 /// </summary>
 /// <param name="type">Type of the unit against which the bonus will be granted</param>
 /// <param name="whichValue">Which value to apply the buff to</param>
 /// <returns>Value of the bonus (0 means no buff or nerf)</returns>
 public static int GetAbsolutPassiveAgainstType(Unit.Type type, Value whichValue)
 {
     return(skillValuesVersusTypeAbsolut[(int)type, (int)whichValue]);
 }
Esempio n. 19
0
 /// <summary>
 /// Gets Bonus stat against a specific unit type (percentage)
 /// </summary>
 /// <param name="type">Type of the unit against which the bonus will be granted</param>
 /// <param name="whichValue">Which value to apply the buff to</param>
 /// <returns>Value of the bonus (1.0f means no buff or nerf)</returns>
 public static float GetPassiveAgainstType(Unit.Type type, Value whichValue)
 {
     return(skillValuesVersusType[(int)type, (int)whichValue]);
 }
Esempio n. 20
0
    // Passiv Buffs & Nerfs against specific types of enemys

    /// <summary>
    /// Sets Bonus stat against a specific unit type (percentage)
    /// </summary>
    /// <param name="type">Type of the unit against which the bonus will be granted</param>
    /// <param name="whichValue">Which value to apply the buff to</param>
    /// <param name="valueToSetTo">Value to set the bonus to (1.0f means no buff or nerf)</param>
    public static void SetPassiveAgainstType(Unit.Type type, Value whichValue, float valueToSetTo)
    {
        skillValuesVersusType[(int)type, (int)whichValue] = valueToSetTo;
    }