Ejemplo n.º 1
0
 void OnDrawGizmos()
 {
     if (isDebug)
     {
         var rect = GameObject.Find("/Scenes").transform.Find(sceneCode.ToString()).GetComponent <SceneCodeUtil>().CameraClamp;
         Gizmos.DrawLine(new Vector2(rect.xMin - viewportWorldSize.x / 2, rect.yMin - viewportWorldSize.y / 2),
                         new Vector2(rect.xMin - viewportWorldSize.x / 2, rect.yMax + viewportWorldSize.y / 2));
         // top border
         Gizmos.DrawLine(new Vector2(rect.xMin - viewportWorldSize.x / 2, rect.yMax + viewportWorldSize.y / 2),
                         new Vector2(rect.xMax + viewportWorldSize.x / 2, rect.yMax + viewportWorldSize.y / 2));
         // right border
         Gizmos.DrawLine(new Vector2(rect.xMax + viewportWorldSize.x / 2, rect.yMin - viewportWorldSize.y / 2),
                         new Vector2(rect.xMax + viewportWorldSize.x / 2, rect.yMax + viewportWorldSize.y / 2));
         // buttom border
         Gizmos.DrawLine(new Vector2(rect.xMin - viewportWorldSize.x / 2, rect.yMin - viewportWorldSize.y / 2),
                         new Vector2(rect.xMax + viewportWorldSize.x / 2, rect.yMin - viewportWorldSize.y / 2));
     }
     else
     {
         // left border
         Gizmos.DrawLine(new Vector2(cameraClamp.xMin - viewportWorldSize.x / 2, cameraClamp.yMin - viewportWorldSize.y / 2),
                         new Vector2(cameraClamp.xMin - viewportWorldSize.x / 2, cameraClamp.yMax + viewportWorldSize.y / 2));
         // top border
         Gizmos.DrawLine(new Vector2(cameraClamp.xMin - viewportWorldSize.x / 2, cameraClamp.yMax + viewportWorldSize.y / 2),
                         new Vector2(cameraClamp.xMax + viewportWorldSize.x / 2, cameraClamp.yMax + viewportWorldSize.y / 2));
         // right border
         Gizmos.DrawLine(new Vector2(cameraClamp.xMax + viewportWorldSize.x / 2, cameraClamp.yMin - viewportWorldSize.y / 2),
                         new Vector2(cameraClamp.xMax + viewportWorldSize.x / 2, cameraClamp.yMax + viewportWorldSize.y / 2));
         // buttom border
         Gizmos.DrawLine(new Vector2(cameraClamp.xMin - viewportWorldSize.x / 2, cameraClamp.yMin - viewportWorldSize.y / 2),
                         new Vector2(cameraClamp.xMax + viewportWorldSize.x / 2, cameraClamp.yMin - viewportWorldSize.y / 2));
     }
 }
Ejemplo n.º 2
0
    private void DemonSceneCode(SceneCode sceneCode)
    {
        ResetAllSceneCode();
        Transform centerPoint = GameObject.Find("/Scenes").transform.Find(sceneCode.ToString()).Find("CenterPoint");

        if (centerPoint == null)
        {
            centerPoint                  = new GameObject("CenterPoint").transform;
            centerPoint.position         = Vector3.zero;
            centerPoint.transform.parent = GameObject.Find("/Scenes").transform.Find(sceneCode.ToString());
        }

        EnterSceneCode(sceneCode);
        //Debug.Log(demonScenes[index].ToString());
        Camera.main.transform.position = new Vector3(centerPoint.position.x, centerPoint.position.y, Camera.main.transform.position.z);
        Camera.main.GetComponent <BasicFollower>().UpdateCameraFollowing(centerPoint);
    }
Ejemplo n.º 3
0
    public void EnterSceneCode(SceneCode sceneCode)
    {
        GameObject sceneGO = GameObject.Find("/Scenes").transform.Find(sceneCode.ToString()).gameObject;

        sceneGO?.SetActive(true);

        Camera.main.GetComponent <BasicFollower>().cameraClamp = sceneGO.GetComponent <SceneCodeUtil>().CameraClamp;
    }
Ejemplo n.º 4
0
    public void EnterSceneCode(SceneCode sceneCode)
    {
        GameObject sceneGO = GameObject.Find("/Scenes").transform.Find(sceneCode.ToString()).gameObject;

        sceneGO?.SetActive(true);

        Camera.main.GetComponent <BasicFollower>().cameraClamp = sceneGO.GetComponent <SceneCodeUtil>().CameraClamp;

        UIEventListener.Instance.OnInfomationChange(new UIEventListener.InfomationChangeData(SceneCodeDisplayName.names[(int)sceneCode]));
    }
Ejemplo n.º 5
0
 void Start()
 {
     transform.name = sceneCode.ToString();
 }
Ejemplo n.º 6
0
    public void ExitSceneCode(SceneCode sceneCode)
    {
        GameObject sceneGO = GameObject.Find("/Scenes").transform.Find(sceneCode.ToString()).gameObject;

        sceneGO?.SetActive(false);
    }