Пример #1
0
        void LateUpdate()
        {
            if (t_load.active)
            {
                return;
            }

            if (!loaded && controller.LoadState == Controller.State.Finished)
            {
                controller.viewGraphs = true;
                t_load.Start(0.4f, () => {
                    controller.viewGraphs = false;
                    Load();
                });
            }

            // Debug
            if (Input.GetKeyDown(KeyCode.D))
            {
                showMainActorDebug = !showMainActorDebug;
            }

#if UNITY_EDITOR
            if (Input.GetKeyDown(KeyCode.T))
            {
                if (UnityEditor.Selection.gameObjects.Length != 0)
                {
                    mainActor.pos = UnityEditor.Selection.gameObjects[0].transform.position;
                }
            }
            if (Input.GetMouseButton(0))
            {
                var ms = RayCollider.RaycastMouse();
                if (ms.hitPerso == null)
                {
                    ms = RayCollider.RaycastMouse(true);
                }
                if (ms.hitPerso != null)
                {
                    UnityEditor.Selection.activeObject = ms.hitPerso.gameObject;
                }
            }
#endif

            //if (Input.GetKeyDown(KeyCode.J))
            //SceneManager.LoadScene(0);
        }
Пример #2
0
        void Update()
        {
            var c = RayCollider.Raycast(caster.transform.position +
                                        Vector3.up * (0.25f + caster.col.groundLevel), Vector3.down, fadeDistance);

            if (c.AnyGround)
            {
                mr.enabled         = true;
                transform.position = c.hit.point + c.hit.normal * 0.0375f;
                transform.LookAt(c.hit.point + c.hit.normal);
                transform.rotation  *= Quaternion.Euler(180, 0, 0);
                transform.localScale = Vector3.one * size - Vector3.one * size * c.hit.distance / fadeDistance;
            }
            else
            {
                mr.enabled = false;
            }
        }
Пример #3
0
 public CollideInfo Raycast(Vector3 offset, Vector3 dir, float dist)
 => RayCollider.Raycast(pos + offset, dir, dist);