Beispiel #1
0
 /// <summary>
 /// Updateの後に呼ばれる
 /// </summary>
 void LateUpdate()
 {
     if (proCamera.CameraTargets.Count == 0 && proCamera.OffsetX != 0f && proCamera.OffsetY != 0f)
     {
         proCamera.AddCameraTarget(PlayerAccessor.Inst.GetPlayer().transform);
     }
 }
Beispiel #2
0
        public void AddNewTarget(Transform transform, bool instantTarget = false)
        {
            float duration = instantTarget ? 0f : cloneTransitionTime;

            cam.RemoveAllCameraTargets(duration);
            cam.AddCameraTarget(transform, 1, 1, duration, new Vector2(offsetX, offsetY));
        }
Beispiel #3
0
    void SetTargetBase(Transform newTarget, float timeReachNewTarget)
    {
        if (isTemporal)
        {
            return;
        }

        proCamera2D.RemoveCameraTarget(currentTarget);
        proCamera2D.RemoveCameraTarget(newTarget);
        currentTarget = newTarget;
        proCamera2D.AddCameraTarget(newTarget, 1, 1, timeReachNewTarget);
    }
Beispiel #4
0
    public IEnumerator ZoomOutToMapView()
    {
        // ProCamera2D.Zoom(sizeOfMapCamera - defaultSizeOfGameCamera, 0, EaseType.)

        float time = 0.0f;

        ourProCamera.RemoveCameraTarget(player.transform);
        ourProCamera.AddCameraTarget(darkStar.transform);

        while (gameCamera.orthographicSize < sizeOfMapCamera)
        {
            if (gameCamera.orthographicSize > sizeOfMapCamera - 0.8f)
            {
                // StartCoroutine(FadeInMap(10f));
                break;
            }
            gameCamera.orthographicSize = Mathf.SmoothStep(gameCamera.orthographicSize, sizeOfMapCamera, time);
            time += Time.deltaTime * 0.5f;

            yield return(null);
        }
        StartCoroutine(FadeInMap(10.0f));
        zoomedInToGame = false;
    }
Beispiel #5
0
    protected override void OnEnable()
    {
        base.OnEnable();

        _initialCamSize          = ProCamera2D.ScreenSizeInWorldCoordinates.y * .5f;
        originalTargets          = ProCamera2D.CameraTargets.ToArray();
        originalTargetInfluences = new Vector2[originalTargets.Length];

        CenterPanTargetOnCamera(0);
        ProCamera2D.AddCameraTarget(_panTarget);

        for (int i = 0; i < originalTargets.Length; i++)
        {
            originalTargetInfluences[i] = new Vector2(originalTargets[i].TargetInfluenceH, originalTargets[i].TargetInfluenceV);

            originalTargets[i].TargetInfluence = 0;
        }
    }
    public void Init()
    {
        NumericBoundaries.enabled = true;
        prcShake.enabled          = true;
        procam.enabled            = true;
        procam.AddCameraTarget(PlayerController.instance.transform);
        NumericBoundaries.RightBoundary = GameController.instance.currentMap.procam2DTriggerBoudaries[currentCamBoidaries].RightBoundary + GameController.instance.currentMap.procam2DTriggerBoudaries[currentCamBoidaries].transform.position.x;
        //  NumericBoundaries.TopBoundary = 4;

        if (!GameController.instance.currentMap.isRedZone)
        {
        }
        else
        {
            ActiveRedZone();
            objRedZone.SetActive(true);
            lineredzone.enabled = true;
        }
    }
    static void CreateNext(int _next)
    {
        GameObject prefab = GetCharacterPrefab(_next);
        Transform  sp     = GetSpawnpoint();

        GameObject newCharacterObj = Instantiate(prefab, sp.position, Quaternion.identity);

        newCharacterObj.name = prefab.name;
        ProCamera2D cam2D = FindObjectOfType <ProCamera2D>();

        if (cam2D != null)
        {
            cam2D.RemoveAllCameraTargets();
            cam2D.AddCameraTarget(newCharacterObj.transform);
            EditorUtility.SetDirty(cam2D);
        }

        CharacterLoader charLoader = FindObjectOfType <CharacterLoader>();

        if (charLoader != null)
        {
            charLoader.character = newCharacterObj.GetComponent <Character>();
            EditorUtility.SetDirty(charLoader);
        }

        UIHealth_Icons uiHealth = FindObjectOfType <UIHealth_Icons>();

        if (uiHealth != null)
        {
            uiHealth.characterHealth = newCharacterObj.GetComponent <CharacterHealth>();
            EditorUtility.SetDirty(uiHealth);
        }

        EditorUtility.SetDirty(newCharacterObj);
        AssetDatabase.Refresh();
        AssetDatabase.SaveAssets();

#if UNITY_EDITOR
        EditorSceneManager.SaveOpenScenes();
#endif
    }
        public CameraAddTarget(Environment environment, BaseEvent eventFrame, Character caster)
        {
            this.environment = environment;
            this.eventFrame  = eventFrame;

            CameraAction ca = (CameraAction)eventFrame.ShowAction();

            atf = (CameraAction.AddTargetFx)ca.fx;
            Character target = environment.FindNearbyCharacters(
                caster, Vector3.zero, 999,
                new[] { FindingFilter.ExcludeMe, FindingFilter.ExcludeDead, FindingFilter.ExcludeAllies }
                )[0];

            joint = target.GameObject().transform.FindDeepChild(atf.joint);
            pc2d  = environment.GetCamera().GetComponent <ProCamera2D>();
            casterCameraTarget = pc2d.CameraTargets[0];
            originalX          = casterCameraTarget.TargetInfluenceH;
            originalY          = casterCameraTarget.TargetInfluenceV;
            casterCameraTarget.TargetInfluenceH = atf.curInfX;
            casterCameraTarget.TargetInfluenceV = atf.curInfY;
            cameraTarget = pc2d.AddCameraTarget(
                joint, atf.influenceY, atf.influenceX, atf.translationDuration
                );
        }
Beispiel #9
0
 private void Start()
 {
     soulOrb.ShowSoulOrb();
     camera2d.AddCameraTarget(player, 1, 1);
 }
 void Start()
 {
     cam.AddCameraTarget(CameramanSW.transform);
     StartCoroutine(OpeningTargets());
 }
Beispiel #11
0
    // Use this for initialization
    void Start()
    {
        ProCamera2D cam = Camera.main.GetComponent <ProCamera2D>();

        cam.AddCameraTarget(this.transform);
    }
    IEnumerator AddTarget(float delay)
    {
        yield return(new WaitForSeconds(delay));

        pc2d.AddCameraTarget(Player.transform);
    }
Beispiel #13
0
    //  Sets up the scene on master scene loaded
    private void SetUpScene(Scene scene, LoadSceneMode mode)
    {
        //Debug.Log("Scene loaded: current checkpoint: " + CurrentCheckpointID);
        //  If the scene loaded was not the master scene, then do nothing.
        if (scene.buildIndex != 1)
        {
            return;
        }

        //  Reset avliable timelines
        hasPresentWisp = false;
        hasPastWisp    = false;
        hasFutureWisp  = false;

        //  Fetch & Cache all the checkpoints, then sort by their checkpoint IDs
        Checkpoints = Resources.FindObjectsOfTypeAll(typeof(Checkpoint)) as Checkpoint[];
        SortCheckpointsByQuickSort(Checkpoints, 0, Checkpoints.Length - 1);
        //for (int i = 0; i < Checkpoints.Length; i++)
        //    Debug.Log(Checkpoints[i].checkpointID);

        //  Turn off all level segments as a clean slate
        for (int i = 0; i < Checkpoints.Length; i++)
        {
            Checkpoints[i].SegmentGO.SetActive(false);
        }

        //  Find the current areaID the player is in
        Vector3 currentCheckpointPosition = Vector3.zero;

        for (int i = 0; i < Checkpoints.Length; i++)
        {
            if (Checkpoints[i].checkpointID == CurrentCheckpointID)
            {
                //  Set the player position of the checkpoint
                currentCheckpointPosition = Checkpoints[i].transform.position;

                //  Load in the level segment previous of the checkpointID
                if (i - 1 >= 0)
                {
                    Checkpoints[i - 1].SegmentGO.SetActive(true);
                }

                //  Load in the level of the checkpoint ID
                Checkpoints[i].SegmentGO.SetActive(true);

                //  Load the level segment after the checkpoint ID
                if (i + 1 < Checkpoints.Length)
                {
                    Checkpoints[i + 1].SegmentGO.SetActive(true);
                }

                break;
            }
        }

        //  Instantiate the player at the checkpoint location
        GameObject player = Instantiate(playerPrefab, currentCheckpointPosition, Quaternion.identity) as GameObject;

        //  Event
        if (OnPlayerSpawned != null)
        {
            OnPlayerSpawned();
        }

        //  Set up camera
        ProCamera2D proCamera2D = ProCamera2D.Instance;

        proCamera2D.AddCameraTarget(player.transform);
        //  camera railing
        ProCamera2DRails proCamera2DRails = proCamera2D.GetComponent <ProCamera2DRails>();

        if (proCamera2DRails != null)
        {
            proCamera2DRails.AddRailsTarget(player.transform);
            proCamera2D.CameraTargets[0].TargetInfluenceH = 0.5f;
            proCamera2D.CameraTargets[0].TargetInfluenceV = 0.5f;
        }
        //  move instant so theres no late follow upon loading.
        proCamera2D.MoveCameraInstantlyToPosition(new Vector2(player.transform.position.x, player.transform.position.y));

        //  Transition Enter
        TransitionCameraEnter();
    }
 void CenterOnDarkStar()
 {
     focusedOnDarkStar = true;
     ourProCamera2D.RemoveCameraTarget(player.transform);
     ourProCamera2D.AddCameraTarget(darkStar.transform);
 }
Beispiel #15
0
 public void AddTarget(Transform newTarget)
 {
     _proCamera2D.AddCameraTarget(newTarget);
 }