public IdleAttackOrder(UnitStatsComponent stats, Vector3 currentPosition, Seeker seeker, GameObject self) { this.self = self; this.stats = stats; this.currentPosition = currentPosition; attackOrder = new AttackOrder(stats, currentPosition, null, seeker, self); }
public AttackOrder(UnitStatsComponent stats, Vector3 currentPosition, GameObject target, Seeker seeker, GameObject attacker) { this.self = attacker; this.stats = stats; this.currentPosition = currentPosition; this.target = target; this.seeker = seeker; moveOrder = new MoveOrder(stats, currentPosition); }
protected override void OnApplyEffect(int level) { if (!unitStats) { unitStats = GetComponent <UnitStatsComponent>(); } unitStats.SetInvulnerable(true); }
protected override void OnApplyEffect(int level) { if (!unitStats) { unitStats = GetComponent <UnitStatsComponent>(); } unitStats.ChangeDamage(DamageIncrease[level - 1]); unitStats.ChangeLifeStealPercentage(LifeStealPercentage[level - 1]); }
void Start() { ownerStats = Owner.GetComponent <UnitStatsComponent>(); stats.evasionChance = ownerStats.EvasionChance; stats.critChance = ownerStats.CritChance; stats.critExtraMultiplier = ownerStats.CritExtraMultiplier; stats.attackType = ownerStats.AttackType; stats.damage = ownerStats.Damage; stats.projectileSpeed = ownerStats.ProjectileSpeed; }
protected override void OnApplyEffect(int level) { if (!unitStats) { unitStats = GetComponent <UnitStatsComponent>(); } unitStats.IncreaseHealthRegeneration(HealthRegen[level - 1]); unitStats.ChangeMovementSpeedPercentage(MovementSpeedPercentage[level - 1]); }
/** * SETTERS AND CHANGERS */ // defence public void DealDamage(float amount, UnitStats attackerStats, UnitStatsComponent attackerStatsComponent) { if (Invulnerable) { return; } // Check if the target evades the projectile and proceed if it doesn't if (!(EvasionChance > 0f && Random.value < EvasionChance)) { // Check if the thrower crits and increase damage if successful if (attackerStats.critChance > 0f && Random.value < attackerStats.critChance) { // Crit was successful amount *= (1 + attackerStats.critExtraMultiplier); } // Modify damage from target's armor and armor type, and attacker's attack type. amount *= GameplayConstants.ArmorDamageReduction(attackerStats.attackType, ArmorType, Armor); unitStats.health -= amount; if (attackerStatsComponent) { attackerStatsComponent.ApplyOnAttackEffects(amount); } if (IsDead) { // Give gold to killing player (always gives to Client as-of-now) GameObject client = GameObject.Find("Client"); client.GetComponent <GoldContainer>().ChangeGold(gameObject.GetComponent <UnitStatsComponent>().GoldDropped); // Give experience to the killing team (always gives to west team as-of-now) Teams team = Globals.Teams; int teamMembers = team.CountTeam(true); foreach (GameObject hero in team.WestTeam) { if (hero) { // Divide experience between all Heroes on the killing team, calculated from a base value factored by the killed unit's level float experience = GameplayConstants.MonsterLevelOneExpDrop * Mathf.Pow(GameplayConstants.MonsterExpDropIncreaseFactorPerLevel, MonsterLevel) / teamMembers; hero.GetComponent <HeroStatsComponent>().AddExperience(experience); } } // and destroy Destroy(gameObject); } else if (Health > MaxHealth) { unitStats.health = unitStats.maxHealth; } } }
void Start() { seeker = GetComponent <Seeker>(); stats = GetComponent <UnitStatsComponent>(); orders = new List <Order>(); idleAttackOrder = new IdleAttackOrder(stats, transform.position, seeker, gameObject); idleAttackOrder.SetProjectilePrefab(projectilePrefab); var go = GameObject.Find("StartPos"); transform.position = go.transform.position; }
protected override void OnApplyEffect(int level) { if (!unitStats) { unitStats = GetComponent <UnitStatsComponent>(); } unitStats.IncreaseEvasionChance(Evasion[level - 1]); unitStats.IncreaseCritChance(CritChance[level - 1]); unitStats.IncreaseCritExtraMultiplier(CritExtraMultiplier [level - 1]); }
public AttackMoveOrder(UnitStatsComponent stats, Vector3 currentPosition, Seeker seeker, Vector3 targetPosition, GameObject attacker) { this.self = attacker; // the unit issuing the attack. inherited from Order this.stats = stats; this.currentPosition = currentPosition; this.seeker = seeker; this.targetPosition = targetPosition; attackOrder = new AttackOrder(stats, currentPosition, null, seeker, attacker); moveOrder = new MoveOrder(stats, currentPosition); }
// Use this for initialization void Start() { seeker = GetComponent <Seeker>(); stats = GetComponent <UnitStatsComponent>(); goal_go = GameObject.FindGameObjectWithTag("goal"); if (!goal_go) { Debug.Log("Could not find goal."); } attackMoveOrder = new AttackMoveOrder(stats, transform.position, seeker, goal_go.transform.position, gameObject); attackMoveOrder.SetProjectilePrefab(projectilePrefab); attackMoveOrder.enemyLayer = LayerMasks.Ally10; }
public void SetTarget(GameObject new_target) { GameObject oldTarget = this.target; this.target = new_target; target = new_target; if (new_target != null && oldTarget != new_target) { targetStats = target.GetComponent <UnitStatsComponent>(); if (targetStats && targetStats.Invulnerable) { target = null; } } }
public MoveOrder(UnitStatsComponent stats, Vector3 currentPosition) { this.stats = stats; this.currentPosition = currentPosition; }