예제 #1
0
    public void SetCinematic(int index)
    {
        if (index < 0 || index > cinematicsManager.cinematics.Count)
        {
            return;
        }
        cinematicIndex   = index;
        currentCinematic = index;
        index--;

        actors = new PersoBehaviour[0];
        if (cinematic != null)
        {
            foreach (CinematicActor actor in cinematic.actors)
            {
                PersoBehaviour pb = actor.perso.Gao.GetComponent <PersoBehaviour>();
                actor.cineState.anim_ref = MapLoader.Loader.FromOffset <AnimationReference>(actor.cineState.off_anim_ref);
                pb.SetState(actor.waitState.index);
            }
            cinematic = null;
        }
        if (index != -1)
        {
            cinematic = cinematicsManager.cinematics[index];
            actors    = cinematic.actors.Select(a => a.perso.Gao.GetComponent <PersoBehaviour>()).ToArray();
            foreach (CinematicActor actor in cinematic.actors)
            {
                PersoBehaviour pb = actor.perso.Gao.GetComponent <PersoBehaviour>();
                actor.cineState.anim_ref = actor.anim_ref;
                actor.cineState.speed    = actor.cineStateSpeed;
                pb.SetState(actor.cineState.index);
            }
        }
    }
예제 #2
0
    private void Awake()
    {
        if (_instance == null)
        {
            _instance           = this;
            _instance.hideFlags = HideFlags.HideInInspector | HideFlags.HideInHierarchy;
            _instance.gameObject.AddComponent <ScreenResizeEvent>();

            _isCinematicActive = false;

            if (_topBar == null)
            {
                CreateTopBar();
            }

            if (_bottomBar == null)
            {
                CreateBottomBar();
            }
        }
        else
        {
            DestroyImmediate(this);
        }
    }
예제 #3
0
    private IEnumerator CinematicFading(float fadeTime, FadeType type, Cinematic origin)
    {
        float time = 0;

        animFader.gameObject.SetActive(true);
        animFader.color = type == FadeType.Out ? Color.black : Color.clear;
        if (type == FadeType.InOut)
        {
            fadeTime /= 2;
        }

        while (time < fadeTime)
        {
            time           += Time.deltaTime;
            animFader.color = type == FadeType.Out ? Color.black * (1 - time / fadeTime) : Color.black * time / fadeTime;

            if (type == FadeType.InOut && time >= fadeTime)
            {
                type = FadeType.Out;
                time = 0;
                origin.SendMessage("OnTransition");
            }
            yield return(null);
        }

        if (origin != null)
        {
            origin.SendMessage("OnComplete");
        }
    }
예제 #4
0
        private void OpeningSequenceUpdate()
        {
            switch (_openingSequenceStage)
            {
            case eOpeningSequenceStage.autoPinch:
                float mult = (Time.time - _autoPinchStartTime) / OpeningAutoPinchTime;
                if (mult >= 1f)                         // finished auto pinch
                {
                    _cameraComponent.SetZoomDistance(1f);
                    _openingSequenceStage = eOpeningSequenceStage.none;

                    if (UIHierarchyHelper.Instance)
                    {
                        UIHierarchyHelper.Instance.ShowRegularHUD(true);                                 // we're going back to the normal HUD
                    }
                    //EventManager.instance.Raise(new IntroCompleteEvent()); // the intro sequence is over
                    PlayerController.LocalPlayerEnableNavigation();                             // normal player control

                    StartWalk(_spawnerFacingDirection);
                }
                else
                {
                    mult = Cinematic.Smooth(mult, CameraLerp.LerpSmoothing.slowFastSlow);
                    _cameraComponent.SetZoomDistance(mult);
                }
                break;

            case eOpeningSequenceStage.none:
                break;

            default: break;
            }
        }
예제 #5
0
 // pause the active cinematic
 static public void UnpauseSpecifiedCinematic(Cinematic cinematicComp)
 {
     if (_activeCinematic == cinematicComp)
     {
         UnpauseActiveCinematic();
     }
 }
예제 #6
0
    void Awake()
    {
        acceleration =  new Cinematic(10f, jumpSpeed);
        y0 = transform.position.y;
        //Debug.LogError ("Y0=" + y0);

        platformerChar = GetComponent<PlatformerChar> ();
    }
예제 #7
0
    void Awake()
    {
        acceleration = new Cinematic(10f, jumpSpeed);
        y0           = transform.position.y;
        //Debug.LogError ("Y0=" + y0);

        platformerChar = GetComponent <PlatformerChar> ();
    }
예제 #8
0
 /// <summary>
 /// Enables the cinematic fader with options
 /// </summary>
 /// <param name="fadeTime">The duration of the fade</param>
 /// <param name="type">The fade type</param>
 /// <param name="origin">The origin cinematic to respond</param>
 public void CinematicFade(float fadeTime, FadeType type, Cinematic origin)
 {
     if (type != FadeType.InOut)
     {
         origin.SendMessage("OnTransition");
     }
     StartCoroutine(CinematicFading(fadeTime, type, origin));
 }
예제 #9
0
        public void Start()
        {
            string     name            = GetParameter(0);
            GameObject moveObject      = GameObject.Find(name);
            Cinematic  CinemaComponent = moveObject.GetComponent <Cinematic>();

            Cinematic.Play(CinemaComponent, PlayerManager.LocalPlayerGameObject());
            Stop();
        }
예제 #10
0
 private void IntroCinematic_Load(object sender, EventArgs e)
 {
     Music.mainmenu = false;
     Forms.f00.MusicPlayer.Ctlcontrols.stop();
     CinematicPlayer.URL = Application.StartupPath + @"/cinematics/intro.wmv";
     CinematicPlayer.Ctlcontrols.play();
     Forms.f00.MusicPlayer.URL = Application.StartupPath + @"/music/Visions of the Past.mp3";
     Forms.f00.MusicPlayer.settings.setMode("loop", false);
     Cinematic.Start();
 }
예제 #11
0
    public void StartCinematic(Cinematic cinematic)
    {
        EnterCinematicState();

        cinematic.postCinematicCallback = delegate()
        {
            StopCinematic(cinematic);
        };
        cinematic.StartCinematic();
    }
 protected override void Awake()
 {
     levelLoader         = Harmony.Finder.LevelLoader;
     onLevelChange       = Harmony.Finder.OnLevelChange;
     gameSettings        = Harmony.Finder.GameSettings;
     cameraStartPosition = camera.transform.position;
     cinematic           = GetComponent <Cinematic>();
     cinematicController = GetComponent <CinematicController>();
     onLevelChange.Publish(this);
 }
예제 #13
0
        public static bool Prefix(Cinematic cimenatic)
        {
            //Skip intro/landing camera cinematics only if a delivery has been called.
            if (cimenatic is IntroCinemetic)
            {
                return(!DeliveriesMod.ActiveDeliveryShip);
            }

            return(true);
        }
예제 #14
0
    private void OnEnable()
    {
        Cinematic.Switches currentCinematicSwitches = Cinematic.GetCurrentCinematicSwitches();
        if (null != currentCinematicSwitches)         // a cinematic is running
        {
            OnCinematicEvent(currentCinematicSwitches, CinematicEvent.CinematicEventType.starting);
        }

        EventManager.instance.AddListener <CinematicEvent>(OnCinematicEvent);
    }
예제 #15
0
    // get the type of the current camera
    public string GetCurrentCameraTypeText()
    {
        Cinematic activeCinematic = Cinematic.GetActiveCinematic();

        if (null != activeCinematic)
        {
            return("Cinematic");
        }
        return("GameCameraBehavior");
    }
예제 #16
0
    public void action()
    {
        Cinematic c = _attachedNPC.GetComponent <Cinematic>();

        if (!!c)
        {
            Debug.Log("NEXT CINEMATIC STAGE");
            c.playCinematic();
        }
        _isActive = true;
    }
예제 #17
0
 // after the dialogue starts cameras, get the transform
 private void GetLatestCameraTransform(Dialogue.DialogueData.DialoguePoint conversation, ref Vector3 outPosition, ref Quaternion outRotation)
 {
     if (Cinematic.IsCinematicActive())
     {
         Cinematic.GetCurrentCinematicTransform(ref outPosition, ref outRotation);
     }
     else
     {
         _cameraComponent.GetNewestGameCameraBehaviorTransform(ref outPosition, ref outRotation);
     }
 }
예제 #18
0
    public void exit()
    {
        Cinematic c = _attachedNPC.GetComponent <Cinematic>();

        if (!!c)
        {
            Debug.Log("EXIT CINEMATIC");
            c.quitCinematic();
        }
        _isActive = false;
    }
예제 #19
0
    private void InternalUpdate(float deltaTime)
    {
        UpdateGameCamera(deltaTime);

        if (_isCinematicActive)
        {
            Vector3    tempPosition = Vector3.zero;
            Quaternion tempQuat     = Quaternion.identity;
            Cinematic.GetCurrentCinematicTransform(ref tempPosition, ref tempQuat);

            transform.position = tempPosition;
            transform.rotation = tempQuat;
        }

        if (_isStillCamActive)
        {
            transform.position = _stillCameraPosition;
            transform.rotation = _stillCameraRotation;
        }

#if DEBUG
        // if we are turning the debug camera on
        if (_previousFrameDebugCamera != debugCamera && eDebugCameraType.None == _previousFrameDebugCamera)
        {
            _debugCameraPosition = transform.position;
            _debugCameraRotation = transform.rotation;
        }

        switch (debugCamera)
        {
        case eDebugCameraType.SceneCamera:
            if (null != Camera.current && null != Camera.current.transform)
            {
                _debugCameraPosition = Camera.current.transform.position;
                _debugCameraRotation = Camera.current.transform.rotation;
            }
            break;

        case eDebugCameraType.FlyCamera:
            UpdateDebugFlyCamera();
            break;

        default: break;
        }

        if (eDebugCameraType.None != debugCamera)
        {
            transform.position = _debugCameraPosition;
            transform.rotation = _debugCameraRotation;
        }

        _previousFrameDebugCamera = debugCamera;
#endif
    }
예제 #20
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    //  Called once when the game is over
    /// </summary>
    public void OnGameover(bool win)
    {
        _MatchVictory = win;
        _GameIsOver   = true;

        // Start game over cinematic
        Cinematic cine = WaveManager.Instance.CinematicDefeat;

        if (cine != null)
        {
            cine.StartCinematic();
        }
    }
예제 #21
0
    private void OnCinematicButtonReleased(UIEvent e)
    {
        Cinematic componentInChildren = SceneMgr.Get().GetComponentInChildren <Cinematic>();

        if (componentInChildren != null)
        {
            this.Hide(false);
            componentInChildren.Play(new Cinematic.MovieCallback(GameMenu.Get().ShowOptionsMenu));
        }
        else
        {
            Debug.LogWarning("Failed to locate Cinematic component on SceneMgr!");
        }
    }
예제 #22
0
    void Update()
    {
        PlayerInput.SimulateKeyPress();

        if (Cursor.lockState != CursorLockMode.Locked)
        {
            Cursor.lockState = CursorLockMode.Locked;
        }

        if (SceneManager.GetActiveScene().name != OVERWORLDLEVEL || _shrineName.color.a <= 0)
        {
            ShowShrineName();
        }

        switch (_state)
        {
        case State.None:
            break;

        case State.Gameplay:
            if (_playerScript.EnterCinematic)
            {
                _state = State.Cinematic;
                Transform trigger = _playerScript.GetCinematicTrigger;
                if (!trigger)
                {
                    trigger = transform;
                }
                if (_playerScript.StartTeleport)
                {
                    trigger = _player;
                }
                _cinematic = trigger.GetComponent <Cinematic>();
                _cinematic.Begin();
                _playerScript.ControlCar = false;
            }
            break;

        case State.Cinematic:
            if (_cinematic.End)
            {
                _state = State.Gameplay;
                _playerScript.ControlCar     = true;
                _playerScript.EnterCinematic = false;
            }
            break;
        }
    }
예제 #23
0
    private void OnDestroy()
    {
        if (_instance == this)
        {
            DestroyTopBar();
            DestroyBottomBar();

            _instance  = null;
            _topBar    = null;
            _bottomBar = null;
            _panIn     = null;
            _panOut    = null;

            ScreenResizeEvent.onScreenResize -= OnScreenResize;
        }
    }
예제 #24
0
 public void OnPressEnterAtBeginning()
 {
     updateActive = true;
     _startGameText.SetActive(false);
     _logoImage.SetActive(false);
     if (_gameManager.firstGame)
     {
         cutsceneManager.ChangeCutscene(CutsceneManager.Cutscenes.INTRO);
     }
     else
     {
         Cinematic cinematic = GameObject.Find("Player").GetComponent <Cinematic>();
         cinematic.GetComponent <Cinematic>().cinematic = "Abe Rises";
         cinematic.GetComponent <Cinematic>().enabled   = true;
         GameObject.Find("GameManager").GetComponent <PerkManager>().showInstructions = true;
     }
     _healthUICanvas.alpha = 1;
 }
예제 #25
0
    protected void UpdateCameraBehaviors(float delatTime)
    {
        //if (Application.isPlaying) // we only want the output from the running behaviors if we're playing
        //{
        for (int running = GetOldestRunningBehaviorIndex(); running <= GetNewestRunningBehaviorIndex(); ++running)
        {
            if (_gameCamera != _runningBehaviors[running].behavior)                     // we don't tick the game camera here, as that is already ticked in the update function
            {
                _runningBehaviors[running].behavior.Update(this, delatTime);
            }

            if (!_runningBehaviors[running].HasLerpStyleBeenSet())
            {
                GameCameraBehavior olderBehavior = (GetOldestRunningBehaviorIndex() == running) ? null : _runningBehaviors[running - 1].behavior;
                _runningBehaviors[running].lerpStyle = CameraLerp.DetermineBestLerpStyle(olderBehavior, _runningBehaviors[running].behavior);
            }

            _runningBehaviors[running].behavior.GetLookAt(ref _runningBehaviorResult.lookAt);
            _runningBehaviors[running].behavior.GetRotation(ref _runningBehaviorResult.rotation);
            _runningBehaviorResult.distFromLookAt = _runningBehaviors[running].behavior.GetDistFromLookAt();

            // oldest camera is always fully blended in
            float lerp = 1f;
            if (NeedCalculateLerp(running))
            {
                lerp = Mathf.Clamp01(_runningBehaviors[running].CalculateLerpValue());
            }
            float smoothedLerp      = 1f;
            float smoothedLerpPitch = 1f;
            float smoothedLerpYaw   = 1f;
            if (NeedSmoothRunningBehavior(running))                     // not the oldest running cam and not fully blended in
            {
                smoothedLerp      = Cinematic.Smooth(lerp, _runningBehaviors[running].lerp.dialogueCameraLerpSmoothing, _runningBehaviors[running].lerp.animationCurve);
                smoothedLerpPitch = Cinematic.Smooth(lerp, _runningBehaviors[running].lerp.pitchLerpSmoothing, _runningBehaviors[running].lerp.curvePitchLerp);
                smoothedLerpYaw   = Cinematic.Smooth(lerp, _runningBehaviors[running].lerp.yawLerpSmoothing, _runningBehaviors[running].lerp.curveYawLerp);
            }
            BlendedCameraBehavior.BlendedCameraOutput.Lerp(ref _blendedResult, ref _blendedResult, ref _runningBehaviorResult,
                                                           _runningBehaviors[running].lerpStyle, smoothedLerp, smoothedLerpPitch, smoothedLerpYaw);
            _gameCameraPosition = _blendedResult.CalculatePosition();
            _gameCameraRotation = _blendedResult.rotation;
        }
        //}
        RemoveRunningBehaviors();
    }
예제 #26
0
    // play the specified cinematic
    static public bool Play(Cinematic cinematicComp, GameObject localTo)
    {
        if (null == cinematicComp || _isPlayFunctionBlocked)
        {
            return(false);
        }

        _isPlayFunctionBlocked = true;         // code in stop can cause this function to get called again, this blocking flag stops that happening

        if (null != _activeCinematic)
        {
            _activeCinematic.Stop();
        }
        _activeCinematic = cinematicComp;
        cinematicComp.Play(localTo);

        _isPlayFunctionBlocked = false;
        return(true);
    }
예제 #27
0
    // get a description of the current camera
    public string GetCurrentCameraText()
    {
        Cinematic activeCinematic = Cinematic.GetActiveCinematic();

        if (null != activeCinematic)
        {
            return(activeCinematic.name);
        }

        if (Application.isPlaying)
        {
            if (GetNewestRunningBehaviorIndex() >= 0)
            {
                return(_runningBehaviors[GetNewestRunningBehaviorIndex()].behavior.GetCameraText());
            }
            return("NO CAMERA");
        }
        else         // editor
        {
            return("game cam default");
        }
    }
예제 #28
0
        private void ClosingSequenceUpdate()
        {
            switch (_closingSequenceStage)
            {
            case eClosingSequenceStage.autoPinch:
                float mult = (Time.time - _autoPinchStartTime) / ClosingAutoPinchTime;
                if (mult >= 1f)                         // finished auto pinch
                {
                    _cameraComponent.SetZoomDistance(0f);

                    // play the closing animation
                    GameObject         localPlayer = PlayerManager.LocalPlayerGameObject();
                    CharacterComponent charTarget  = null;
                    if (null != localPlayer)
                    {
                        charTarget = localPlayer.GetComponent <CharacterComponent>();
                        if (null != charTarget)
                        {
                            PlayStartOrEndAnimationSound(false);
                            PlaySpecialAnimation(eSpecialAnimationVariety.DungeonEnd, charTarget, false);
                        }
                    }

                    StartCoroutine(WaitForClosingSequenceEnd(charTarget));
                }
                else
                {
                    mult = Cinematic.Smooth(mult, CameraLerp.LerpSmoothing.slowFastSlow);
                    _cameraComponent.SetZoomDistance(_autoPinchStartZoom - mult * _autoPinchStartZoom);
                }
                break;

            case eClosingSequenceStage.none:
                break;

            default: break;
            }
        }
예제 #29
0
    // stop playing the cinematic
    public void Stop()
    {
        if (this == _activeCinematic)
        {
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                EditorApplication.update -= EditorUpdate;
            }
#endif

            if (_skipButton != null)
            {
                Destroy(_skipButton);
            }

            _activeCinematic = null;
            Unpause();
            _cinematicStartTime = CinematicInactive;
#if DEBUG
            PositionRigOnEnd();
#endif
            EventManager.instance.Raise(new CinematicEvent(CinematicEvent.CinematicEventType.ending, switches));

#if UNITY_EDITOR
            if (null != theEditor)
            {
                theEditor.Repaint();
            }
#endif

            if (null != onProgressPoint)
            {
                onProgressPoint();
            }
        }
    }
예제 #30
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            SoundManager.getInstance().init(Content);
            IOHelper.loadConfiguration(IOHelper.getConfiguration());

            this.cinematic   = new Cinematic(Content);
            this.mainMenu    = new MainMenu(Content);
            this.optionsMenu = new OptionsMenu(Content);

            this.fadeParams = new FadeEffectParams {
                OriginalColour      = Color.Black,
                State               = FadeEffect.FadeState.Out,
                TotalTransitionTime = TRANSITION_TIME
            };
            this.fadeEffect = new FadeEffect(fadeParams);

            StaticDrawable2DParams transitionParms = new StaticDrawable2DParams {
                Texture     = LoadingUtils.load <Texture2D>(Content, "Chip"),
                Scale       = new Vector2(Constants.RESOLUTION_X, Constants.RESOLUTION_Y),
                LightColour = Color.Black
            };

            this.transitionItem = new StaticDrawable2D(transitionParms);
            this.transitionItem.addEffect(this.fadeEffect);

#if WINDOWS
#if DEBUG
            ScriptManager.getInstance().LogFile = "Log.log";
            if (StateManager.getInstance().CurrentGameState == GameState.Active || StateManager.getInstance().CurrentGameState == GameState.Waiting ||
                StateManager.getInstance().CurrentGameState == GameState.GameOver)
            {
                this.gameDisplay = new GameDisplay(GraphicsDevice, Content);
            }
#endif
#endif
        }
예제 #31
0
 public void SetupCinematic(Cinematic c)
 {
     Cine = c;
 }