private void Start() { for (int i = 0; i < BrushGOs.Length; i++) { OnTriggerEnterDispatcher lOnTrigger = BrushGOs[i].AddComponent <OnTriggerEnterDispatcher>(); lOnTrigger.OnEnter += OnTriggerEnterEvent; } m_JumpVelocity = Vector3.zero; string lTarget; if (GetValue("target", out lTarget)) { UEntity lEnt = UEntityManager.Instance.ReturnFirstTargetname(lTarget); if (lEnt != null) { Vector3 lDelta = lEnt.transform.position - transform.position; float lGravity = Mathf.Abs(Physics.gravity.y); m_JumpVelocity.y = Mathf.Sqrt(2f * lGravity * Mathf.Abs(lDelta.y)); Vector3 lNorm = lDelta; lNorm.y = 0f; float lDistance = lNorm.magnitude; float lTime = m_JumpVelocity.y / lGravity; float lHorezSpeed = lTime > 0f ? lDistance / lTime : 0f; lNorm.Normalize(); m_JumpVelocity += lNorm * lHorezSpeed; } } }
protected override void InputSystemMenuOnTriggerEnterHandler(OnTriggerEnterDispatcher data, Menu collider, WandRight source) { base.InputSystemMenuOnTriggerEnterHandler(data, collider, source); SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); Debug.Log("Restart"); }
protected override void PlayerSystemFeetOnTriggerEnterHandler(OnTriggerEnterDispatcher data, Feet source) { base.PlayerSystemFeetOnTriggerEnterHandler(data, source); Debug.Log("grounded"); jumpCount = 0; }
protected override void InputSystemOnTriggerEnterHandler(OnTriggerEnterDispatcher data, Grabable collider, WandLeft source) { base.InputSystemOnTriggerEnterHandler(data, collider, source); Debug.Log("Enter"); Debug.Log(collider + "" + source); }
protected override void PlayerSystemOnTriggerEnterHandler(OnTriggerEnterDispatcher data, Checkpoint collider, Player source) { base.PlayerSystemOnTriggerEnterHandler(data, collider, source); lastCheckPoint = collider.transform.position; collider.gameObject.GetComponent <MeshRenderer>().enabled = false; }