private void OnTriggerEnter(Collider collision) { //too soon if (Time.time < nextNailIn) { return; } if (!Hammer) { Hammer = GetComponentInParent <PlayerHammer>(); } if (Hammer && Hammer.IsHammering) { Nail nail = collision.GetComponentInParent <Nail>(); if (nail) { nextNailIn = Time.time + 0.25f; nail.NailMeIn(); if (hitEffect) { //audioSource.Play(); var newEffect = Instantiate(hitEffect, transform.position, Quaternion.identity); Destroy(newEffect, 2f); } } } }
private void SetComponents() { Instance = this; _controls = new InputMaster(); _movement = GetComponent <PlayerMovement>(); _hammer = GetComponent <PlayerHammer>(); _anim = GetComponent <Animator>(); }
private void Awake() { Instance = this; }
private void Awake() { Hammer = GetComponentInParent <PlayerHammer>(); //audioSource = GetComponent<AudioSource>(); }