void CheckTentacleMode() { if (!tentacleMode) { if (grounded && Input.GetButtonDown("EnterTentacleMode")) { tentacleMode = true; SpawnTentacle(); } } else { if (tentacleHead != null && tentacleHead.Retracted()) { Debug.Log("Exit tentacle mode"); tentacleMode = false; DestroyImmediate(tentacleHead.gameObject); tentacleHead = null; } } }
void SpawnTentacle() { GameObject go = Instantiate <GameObject>(tentacleHeadPrefab, tentacleSpawnPoint.position, Quaternion.identity, transform.parent); tentacleHead = go.GetComponent <TentacleHead>(); }