private void Start() { canvas.worldCamera = TheCamera.GetCamera(); if (!TheGame.IsMobile() && ItemSelectedFX.Get() == null && AssetData.Get().item_select_fx != null) { Instantiate(AssetData.Get().item_select_fx, transform.position, Quaternion.identity); } PlayerUI gameplay_ui = GetComponentInChildren <PlayerUI>(); if (gameplay_ui == null) { Debug.LogError("Warning: Missing PlayerUI script on the Gameplay tab in the UI prefab"); } }
public void RaycastFloorPos() { Ray ray = TheCamera.GetCamera().ScreenPointToRay(Input.mousePosition); RaycastHit hit; bool success = Physics.Raycast(ray, out hit, 100f, floor_layer.value); if (success) { floor_pos = ray.GetPoint(hit.distance); } else { Plane plane = new Plane(Vector3.up, 0f); float dist; bool phit = plane.Raycast(ray, out dist); if (phit) { floor_pos = ray.GetPoint(dist); } } //Debug.DrawLine(TheCamera.GetCamera().transform.position, floor_pos); }
private void Start() { canvas.worldCamera = TheCamera.GetCamera(); PlayerCharacter.Get().onDamaged += DoDamageFX; }
//Get ray from camera to mouse private Ray GetMouseCameraRay() { return(TheCamera.GetCamera().ScreenPointToRay(GetClampMousePos())); }