/// <summary> /// Initializes a new instance of the <see cref="Team"/> class. /// Sets the team number to the one specified; also sets a team leader. /// </summary> /// <param name="teamNo">Team number</param> /// <param name="teamLeader">Team leader</param> public Team(int teamNo, Hero teamLeader) { TeamNo = teamNo; TeamLeader = teamLeader; _teamMembers = new List <Character>(); Points = 0; if (teamLeader != null) { TeamLeader.Team = this; if (!teamLeader.IsDead()) { MembersAlive++; } } }
/// <summary> /// Controlls which hero in the area regenerates life. /// </summary> /// <param name="other">The Object this Object collides with</param> public void OnTriggerStay(Collider other) { Hero hero = other.GetComponent <Hero>(); if (hero != null && !hero.IsDead() && (hero.Team == _base.Team)) { int maxHp = hero.MaxHP; _time += Time.deltaTime; if (_time >= _rate) { _time = 0; // reset rate timer if (_net.IsServer) { networkView.RPC("Regenerate", RPCMode.All, hero.name); } else if (!_net.IsClient) { hero.HP += (int)(maxHp * _percent); // need no check whether greater than 'hp + value' because it's set in propertie of charachter.cs } } } }