Beispiel #1
0
    public void Init(UnitStats stats, UnitBaseStats _base)
    {
        m_stats = stats;

        AddItem(LootBalance.GetBalance().GetItem(ItemTypes.stim_pack), _base.StartStimPacks);
        AddItem(LootBalance.GetBalance().GetItem(ItemTypes.rest_pack), _base.StartRestPacks);
    }
Beispiel #2
0
 private void isTargetDead(UnitBaseStats targetStats)
 {
     if (targetStats.health < 1)
     {
         GetComponent <PlayerController>().OnDeath();
         Destroy(targetStats.gameObject);
     }
 }
Beispiel #3
0
 public bool OnSameTeam(UnitBaseStats one, UnitBaseStats two)
 {
     if (one.kingdom.GetId() == two.kingdom.GetId())
     {
         return(true);
     }
     return(false);
 }
Beispiel #4
0
 public TargetType OnSameTeam(UnitBaseStats one, UnitBaseStats two)
 {
     if (one.kingdomID == two.kingdomID)
     {
         return(TargetType.Ally);
     }
     return(TargetType.Enemy);
 }
Beispiel #5
0
    public void MakeStats(UnitBaseStats stats)
    {
        if (m_stats == null)
        {
            m_stats = gameObject.AddComponent <UnitStats>();
        }

        m_stats.Init(StatsHelper.GetStatListForInit(baseStats), null);
    }
Beispiel #6
0
    private bool CombatSwitch(GameObject target, UnitBaseStats targetStats)
    {
        switch (state)
        {
        case CombatState.Idle:
            Debug.Log("Idle");
            deckHandler.ResolveCard();
            return(true);

        case CombatState.Guarding:
            Debug.Log("Guard");
            deckHandler.ResolveCard();
            return(true);

        case CombatState.Dodging:
            Debug.Log("Dodge");
            deckHandler.ResolveCard();
            return(true);

        case CombatState.Attacking:
            if (cardToAttackWith.range > Vector3.Distance(target.transform.position, transform.position))
            {
                targetStats.health -= cardToAttackWith.damage;
                Debug.Log("Attack");
                deckHandler.ResolveCard();
                return(true);
            }
            break;

        case CombatState.RangeAttacking:
            if (cardToAttackWith.range > Vector3.Distance(target.transform.position, transform.position))
            {
                targetStats.health -= cardToAttackWith.damage;
                deckHandler.ResolveCard();
                return(true);
            }
            Debug.Log("Range");
            break;

        case CombatState.SlateAttacking:
            deckHandler.ResolveCard();
            Debug.Log("Slate");
            return(true);

        case CombatState.Healing:
            targetStats.health += cardToAttackWith.damage;
            deckHandler.ResolveCard();
            return(true);

        default:
            Debug.Log("Default");
            return(true);
        }

        return(false);
    }
Beispiel #7
0
    public bool Interaction(GameObject target)
    {
        bool          check       = false;
        UnitBaseStats targetStats = target.GetComponent <UnitBaseStats>();

        if (targetStats)
        {
            check = CombatSwitch(target, targetStats);
            isTargetDead(targetStats);
        }
        return(check);
    }
Beispiel #8
0
 void SpawnUnit()
 {
     if (canSpawn)
     {
         GameObject newUnit = Instantiate(unitToSpawn, spawnLocation);
         newUnit.transform.parent     = null;
         newUnit.transform.localScale = new Vector3(1, 1, 1);
         newUnit.transform.position   = spawnLocation.position;
         UnitBaseStats stats = newUnit.GetComponent <UnitBaseStats>();
         stats.kingdomID = kingdomID;
     }
     canSpawn = false;
 }
Beispiel #9
0
 void SeperateTeams()
 {
     foreach (GameObject unit in allUnits)
     {
         UnitBaseStats unitStats = unit.GetComponent <UnitBaseStats>();
         if (unitStats.kingdomID == 0)
         {
             teamOne.Add(unit);
         }
         if (unitStats.kingdomID == 1)
         {
             teamTwo.Add(unit);
         }
     }
 }
Beispiel #10
0
 public static List <Stat> GetStatListForInit(UnitBaseStats stats)
 {
     return(GetStatListForInit(stats.Survival, stats.Mobility, stats.Tech, stats.Combat, stats.Focus, stats.StartAdrenaline, stats.StartOxyGen, stats.StartTurnTime));
 }