public void spawnTargetOfType(FallingTarget.TargetType type, Vector3 pos) { GameObject spawned = Instantiate(spawnedPrefab, Vector3.zero, Quaternion.Euler(new Vector3(90, 90, 0))) as GameObject; spawned.transform.parent = transform; spawned.transform.localPosition = pos; FallingTarget target = spawned.GetComponent <FallingTarget>(); target.targetType = type; }
void OnTriggerEnter(Collider other) { other.gameObject.SetActive(false); Destroy(other.gameObject); FallingTarget target = other.GetComponent <FallingTarget>(); if (target != null && target.targetType == FallingTarget.TargetType.ShouldCatch) { Services.instance.Get <CatcherGame>().Score--; } }