Exemplo n.º 1
0
        public void Start()
        {
            string     name            = GetParameter(0);
            GameObject moveObject      = GameObject.Find(name);
            Cinematic  CinemaComponent = moveObject.GetComponent <Cinematic>();

            Cinematic.Play(CinemaComponent, PlayerManager.LocalPlayerGameObject());
            Stop();
        }
Exemplo n.º 2
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!");
        }
    }
Exemplo n.º 3
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);
    }
Exemplo n.º 4
0
    // turn on the type of camera we need for this conversation step
    static public void SetUpNewCamera(Dialogue.DialogueData.DialoguePointCamera conversation, CharacterModel inputCaller, List <Dialogue.DialogueData.DialoguePoint> dialoguePoints)
    {
        if (null == conversation.camera)
        {
            return;
        }

        CameraLerp cameraLerp = (null != conversation.cameraLerpOverride) ? conversation.cameraLerpOverride : GlobalDialogueData.Instance.defaultDialogueLerp;

        System.Type cameraType = conversation.camera.GetType();
        if (typeof(GameCameraParams) == cameraType)
        {
            if (null != Camera.main)
            {
                CameraBase cameraComponent = Camera.main.GetComponent <CameraBase>();

                GameCameraParams gameCameraParams = (GameCameraParams)conversation.camera;
                switch (conversation.targets)
                {
                case Dialogue.DialogueData.DialoguePointCamera.CameraTargets.localPlayer:
                    if (gameCameraParams.gameCamera)
                    {
                        cameraComponent.EnterFixedOffsetGameCamera(cameraLerp);
                    }
                    else
                    {
                        PlayerController controller = PlayerManager.LocalPlayerController();
                        if (null != controller)
                        {
                            List <GameObject> target = new List <GameObject>();
                            target.Add(controller.gameObject);
                            cameraComponent.EnterInteractionCamera(ref target, ref gameCameraParams, cameraLerp);
                        }
                    }
                    break;

                case Dialogue.DialogueData.DialoguePointCamera.CameraTargets.all:
                    List <GameObject> targets = new List <GameObject>();
                    Interaction.GetAllInteractionParticipants(ref targets, dialoguePoints);
                    if (targets.Count > 0)
                    {
                        cameraComponent.EnterInteractionCamera(ref targets, ref gameCameraParams, cameraLerp);
                    }
                    break;

                case Dialogue.DialogueData.DialoguePointCamera.CameraTargets.caller:
                    GameObject caller = GlobalUtils.FindCharacter(inputCaller);
                    if (null != caller)
                    {
                        if (inputCaller.isPlayer && gameCameraParams.gameCamera)
                        {
                            cameraComponent.EnterFixedOffsetGameCamera(cameraLerp);
                        }
                        else
                        {
                            List <GameObject> target = new List <GameObject>();
                            target.Add(caller);
                            cameraComponent.EnterInteractionCamera(ref target, ref gameCameraParams, cameraLerp);
                        }
                    }
                    break;

                default: break;
                }
            }
        }
        else if (typeof(CinematicCameraParams) == cameraType)
        {
            if (null != conversation.cinematic)
            {
                if (conversation.IsCinematicAPrefabRequiringInstantiation())
                {
                    GameObject cinematicObject = (GameObject)GameObject.Instantiate(conversation.cinematic);
                    if (null != cinematicObject && cinematicObject.activeInHierarchy)
                    {
                        Cinematic.Play(cinematicObject.GetComponent <Cinematic>(), PlayerManager.LocalPlayerGameObject());
                    }
                }
                else
                {
                    Cinematic.Play(conversation.cinematic.GetComponent <Cinematic>(), PlayerManager.LocalPlayerGameObject());
                }
            }
        }
    }