private void OnTriggerEnter(Collider other) { if (other.tag == "Enemy") { Script_BoidsBehaviour bb = other.GetComponent <Script_BoidsBehaviour>(); if (bb.group.GetTeam() != team) { script_playerLevel playerLvl = script_Manager.Instance.GetPlayer(team).GetComponent <script_playerLevel>(); playerLvl.exp += exp; playerLvl.checkLevel(); other.gameObject.GetComponent <script_enemyInteractions>().Damage(1); Destroy(gameObject); } } if (other.tag == "Wall") { if (other.gameObject.GetComponent <script_Wall>().team != team) { Destroy(gameObject); } } if (other.tag == "Player") { if (other.gameObject.GetComponent <Script_Player_Controller>().index != team) { other.gameObject.GetComponent <Script_Player_Controller>().health -= 1; Destroy(gameObject); } } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Enemy") { script_enemyInteractions eI = other.GetComponent <script_enemyInteractions>(); Script_BoidsBehaviour bB = other.GetComponent <Script_BoidsBehaviour>(); int team = bB.group.GetTeam(); if (team >= 0) { int hp = eI ? eI.health : 1; if (team == 0) { feedValue -= hp; } else if (team == 1) { feedValue += hp; } eI.Damage(hp); if (TransferOwnership(CheckOwnership())) { group.waypoint = nextWaypoints[team]; } } } }
public void AddToGroup(Script_BoidsBehaviour bb) { bb.focus = gameObject; bb.group = this; boids.Add(bb); maxCount++; }
public void AddToGroup(Color c, float distribution) { Script_BoidsBehaviour bb = (Instantiate(boidPrefab, transform.position, boidPrefab.transform.rotation, transform) as GameObject).GetComponent <Script_BoidsBehaviour>(); bb.focus = gameObject; bb.transform.position += new Vector3(Random.Range(-distribution, distribution), 0f, Random.Range(-distribution, distribution)); bb.GetComponent <Renderer>().material.SetColor("_EmissionColor", c * 2.0f); bb.group = this; boids.Add(bb); maxCount++; }
private void OnTriggerEnter(Collider other) { if (other.tag == "Enemy") { Script_BoidsBehaviour bb = other.GetComponent <Script_BoidsBehaviour>(); if (bb.group.GetTeam() != team) { script_playerLevel playerLvl = script_Manager.Instance.GetPlayer(team).GetComponent <script_playerLevel>(); other.gameObject.GetComponent <script_enemyInteractions>().Drain(ref health); if (health <= 0) { markForDeath = true; } } } }