void Start() { _RB = GetComponent <Rigidbody>(); _Pos = transform.position; _Echidna = FindObjectOfType <EchidnaController>(); gameObject.layer = SRLayers.Players; }
// Start is called before the first frame update void Start() { PlayerController[] players = FindObjectsOfType <PlayerController>(); EchidnaController echidna = FindObjectOfType <EchidnaController>(); _TransformsToKeepInFocus.Add(echidna.transform); _TransformsToKeepInFocus.Add(players[0].transform); _TransformsToKeepInFocus.Add(players[1].transform); }
void OnCollisionEnter(Collision collision) { EchidnaController echidna = collision.gameObject.GetComponent <EchidnaController>(); if (echidna != null) { echidna.BeginInteraction(this); SetState(State.PushingEchidna); } }
void Initialise() { PlayerController[] players = FindObjectsOfType <PlayerController>(); EchidnaController echidna = FindObjectOfType <EchidnaController>(); _TransformsToKeepInFocus.Add(echidna.transform); _TransformsToKeepInFocus.Add(players[0].transform); _TransformsToKeepInFocus.Add(players[1].transform); UpdateAverage(); _Initialised = true; }
void BeginInteraction(Interactable interactable) { if (_Debug) { print(name + " begun interaction with " + interactable.gameObject.name + " from layer " + interactable.gameObject.layer.ToString()); } if (interactable.gameObject.layer == SRLayers.Echidna) { SetState(State.InteractingEchidna); EchidnaController echidna = _ActiveInteractable.gameObject.GetComponent <EchidnaController>(); } else if (interactable.gameObject.layer == SRLayers.Interactables) { SetState(State.InteractingEnvironment); } _ActiveInteractable = interactable; _ActiveInteractable.BeginInteraction(this); }