private void Update() { if (state == TELEPORT_STATE.TRIGGERED) { stf.OnStartFade(Color.black, .7f, true); Fillimg.color = new Color(1f, 1f, 1f, 1f); //Debug.Log("Color full"); Fillimg.fillAmount = acumTime; acumTime += Time.smoothDeltaTime; if (Fillimg.fillAmount == 1f) { player.transform.position = new Vector3(target.position.x, player.transform.position.y, target.position.z); stf.OnStartFade(Color.clear, .7f, true); state = TELEPORT_STATE.IDLE; acumTime = 0; } } if (state == TELEPORT_STATE.IDLE) { Fillimg.color = new Color(.5f, .5f, .5f, .5f); stf.OnStartFade(Color.clear, .001f, true); } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("PlayerBody")) { //player.transform.position = new Vector3(target.position.x, player.transform.position.y, target.position.z); state = TELEPORT_STATE.TRIGGERED; } }
private void OnTriggerExit(Collider other) { if (other.gameObject.CompareTag("PlayerBody")) { //player.transform.position = new Vector3(target.position.x, player.transform.position.y, target.position.z); state = TELEPORT_STATE.IDLE; acumTime = 0; } }