void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag == "Player") { characterLight pickupCharacter = other.GetComponentInParent <characterLight>(); foreach (GameObject player in GameObject.FindGameObjectsWithTag("Player")) { if (player.GetComponentInParent <characterLight>() != pickupCharacter) { GameObject light = (GameObject)Instantiate(lightPlayersUp, transform.position + new Vector3(0, 0, -1), transform.rotation); light.GetComponent <LightPlayersUp>().playerToStalk = player.GetComponentInParent <characterLight>(); light.GetComponent <LightPlayersUp>().lifeSpan = lightUpLength; } } Destroy(gameObject, fadeTime); GetComponentInChildren <LightScript>().FadeAway(fadeTime); GetComponent <CircleCollider2D>().enabled = false; GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 0); } }
public void RemoveCharacter(characterLight character) { characters.Remove(character); Debug.Log("Removed: " + character); }