void Start() { bossDamage = GameObject.FindGameObjectWithTag("Boss").GetComponent <BossDamage>(); bossHealth = GameObject.FindGameObjectWithTag("Boss").GetComponent <BossHealth>(); death = GameObject.FindGameObjectWithTag("GameOver"); }
// Use this for initialization void Start() { bossH = gameObject.GetComponentInChildren <BossHealth>(); bossD = gameObject.GetComponentInChildren <BossDamage>(); GetComponent <TextMesh>().text = "Health: " + bossH.currentHealth.ToString(); GetComponent <TextMesh>().text += "\nDamage: " + bossD.totalDamage.ToString(); }
public static void DealBossDamage(Player boss, Player attacker, bool humanAttacker, int attackCount) { IBossDamageRepository repo = new EFBossDamageRepository(); var damage = repo.BossDamages.FirstOrDefault(bf => bf.PlayerId == attacker.Id && bf.BossBotId == boss.BotId); if (damage == null) { damage = new BossDamage { PlayerId = attacker.Id, BossBotId = boss.BotId, Timestamp = DateTime.UtcNow, }; } if (humanAttacker) { damage.PlayerAttacksOnBoss += attackCount; } else { damage.BossAttacksOnPlayer += attackCount; } // calculate a unique score to add, weighted a little in favor of higher level human attackers / victims damage.TotalPoints += (float)attackCount * (.75F + .25F * (float)attacker.Level); damage.Timestamp = DateTime.UtcNow; repo.SaveBossDamage(damage); }
public void SaveBossDamage(BossDamage BossDamage) { if (BossDamage.Id == 0) { context.BossDamages.Add(BossDamage); } else { var editMe = context.BossDamages.Find(BossDamage.Id); if (editMe != null) { // dbEntry.Name = BossDamage.Name; // dbEntry.BossDamage = BossDamage.BossDamage; // dbEntry.TimeStamp = BossDamage.TimeStamp; } } context.SaveChanges(); }
void Start() { bossDamage = gameObject.GetComponent <BossDamage>(); death = GameObject.FindGameObjectWithTag("GameOver"); }