public void dismiss() { soundPlayer.loop = false; soundPlayer.clip = dismissClip; soundPlayer.Play(); agentState = AgentState.Idle; // todo: agents should separate into colour groups agentTarget = transform.position; this.nonTriggerCollider.enabled = true; AgentInteractor agentInteractor = GetComponentInChildren <AgentInteractor>(); if (agentInteractor) // check for interactables nearby { StartCoroutine(agentInteractor.CheckForActions()); } if (agentColour == "blue") { smr.material = greyblueTex; } else if (agentColour == "yellow") { smr.material = greyyellowTex; } else { smr.material = greyredTex; } gameController.updatePikNumbersAndUI(); }
void doCollection() { this.gameObject.tag = "Untagged"; // remove carrying agents for (int i = 0; i < carryPoints.Count; i++) { if (carryPoints[i].Value != null) { AgentInteractor agentInteractor = carryPoints[i].Value.GetComponentInChildren <AgentInteractor>(); if (agentInteractor) { agentInteractor.dropobject(); } } } if (this.gameObject.transform.parent) // on enemy bodies the pickup controller is on a child object { Destroy(this.gameObject.transform.parent.gameObject); } else // on plain items the pickup controller is on the top object { Destroy(this.gameObject); } // todo: pulled-up-into-onion anim, spawn pik seeds or create new piks in onion, etc }
public AgentInteractor fetchInteractor() { AgentInteractor interactor = this.gameObject.GetComponentInChildren <AgentInteractor>(); return(interactor); }