void OnTriggerEnter(Collider other) { ArtefactReceptor receptor = other.GetComponent <ArtefactReceptor> (); if (receptor != null && transporter != null && (receptor.team.side == transporter.team.side)) { InformScore(); BackToBase(); } if (transporter != null) { return; } Player player = other.GetComponent <Player> (); if (player == null || player.isCreature) { return; } if (player.side != team.side) { transporter = player; } else { BackToBase(); } }
void InitializeArtefacts() { foreach (TeamSlot ts in teamSlots) { GameObject artefact = Instantiate(ts.artefactPrefab); artefact.transform.position = ts.artefactSpawn.transform.position; Artefact art = artefact.GetComponent <Artefact> (); art.team = ts.team; art.spawn = ts.artefactSpawn.transform; ts.artefact = art; ArtefactReceptor receptor = ts.receptor.GetComponent <ArtefactReceptor> (); receptor.team = ts.team; artefacts.Add(art); } }