Example #1
0
    private void CutsceButtonClicked(CutScene cs)
    {
        currMission  = null;
        currCutscene = cs;

        MissionDetails.text = cs.GetKey();
    }
 private void Start()
 {
     DontDestroyOnLoad(this.gameObject);
     cutScene = FindObjectOfType(typeof(CutScene)) as CutScene;
     ligar[0].SetActive(false);
     ligar[1].SetActive(false);
 }
Example #3
0
 // Use this for references
 void Awake() {
     messageManager = GameObject.FindGameObjectWithTag("MessageManager").GetComponent<MessageManager>();
     cutScene = GetComponent<CutScene>();
     basePosition = transform.position;
     canvas = GetComponentInChildren<Canvas>().gameObject;
     ChangeTooltipStatus(TooltipManager.On);
 }
Example #4
0
    public override void createUIDescription(CutScene cutScene, SerializedObject serializedObject)
    {
        AnimationNode node = this;

        GUILayout.Label("<<Animation>>");
        node.animation = (Animation)EditorGUILayout.ObjectField("Animation: ", node.animation, typeof(Animation), true);
    }
Example #5
0
 public void EnableSleepingGuard()
 {
     _cutScenePlaying = true;
     _currentCutScene = CutScene.SleepingGuard;
     //_UIMenu.SetActive(true);
     _cutSceneList[(int)CutScene.SleepingGuard].SetActive(true);
 }
Example #6
0
 public void EnableSuccess()
 {
     _cutScenePlaying = true;
     _currentCutScene = CutScene.Success;
     //_UIMenu.SetActive(true);
     _cutSceneList[(int)CutScene.Success].SetActive(true);
 }
Example #7
0
 public void EnableCaptured()
 {
     _cutScenePlaying = true;
     _currentCutScene = CutScene.Captured;
     //_UIMenu.SetActive(true);
     _cutSceneList[(int)CutScene.Captured].SetActive(true);
 }
Example #8
0
    /* *** Activate the required CutScene, set it as current ***
     * *** Make sure all other CutScene are inactive before activating */

    public void EnableIntro()
    {
        _cutScenePlaying = true;
        _currentCutScene = CutScene.Intro;
        //_UIMenu.SetActive(true);
        _cutSceneList[(int)CutScene.Intro].SetActive(true);
    }
Example #9
0
    public IEnumerator jumpToNodeAndPLay()
    {
        int index = currentIndexNode;

        if (index >= currentCutScene.nodeList.Count || !continuePlaying)
        {
            foreach (CutSceneNodes CSN in currentCutScene.nodeList)
            {
                CSN.hasExecutionEnded = false;
                CSN.end();
            }
            currentCutScene = null;
            toggleUIVisibility(false);
            onCutSceneEnd.Invoke();
            yield return(null);
        }
        else
        {
            currentNode          = currentCutScene.nodeList[index];
            currentNode.cutScene = currentCutScene;
            currentNode.start();
            while (!currentNode.hasExecutionEnded && continuePlaying)
            {
                currentNode.update();
                yield return(null);
            }
            currentNode.end();

            if (continuePlaying)
            {
                ++currentIndexNode;
                onGoing = StartCoroutine("jumpToNodeAndPLay");
            }
        }
    }
Example #10
0
    public override void createUIDescription(CutScene cutScene, SerializedObject serializedObject)
    {
        DialogueNonStop node = this;

        GUILayout.Label("<<Dialogue>>");
        float time = EditorGUILayout.Slider("Show Speed", node.letterPause, 0, 1f);

        if (time >= 0f && time <= 10)
        {
            node.letterPause = time;
        }
        Canvas last = canvas;

        node.canvas = (Canvas)EditorGUILayout.ObjectField("Chat Box Canvas: ", node.canvas, typeof(Canvas), true);
        if (node.canvas != last && canvas != null)
        {
            bool isActive = node.canvas.gameObject.activeSelf;
            node.canvas.gameObject.SetActive(true);
            node.chatBox = canvas.GetComponentInChildren <Text>();
            node.canvas.gameObject.SetActive(isActive);
        }
        node.chatBox    = (Text)EditorGUILayout.ObjectField("UIText inside above Canvas: ", node.chatBox, typeof(Text), true);
        node.timeToLive = EditorGUILayout.FloatField("Time To Live", node.timeToLive);
        GUILayout.BeginHorizontal();
        GUILayout.Label("Text: ");
        node.text = EditorGUILayout.TextArea(node.text, GUILayout.Width(300), GUILayout.Height(60));
        GUILayout.EndHorizontal();
    }
Example #11
0
    // parses a cutscene; pos is the line number of the scene in file
    // returns line number at the end of this scene in file
    int parseCutScene(string[] lines, int pos, int curr_scene)
    {
        // read in lines of scene
        List <string> npcs         = new List <string> ();
        List <string> whos_talking = new List <string> ();
        List <string> dialogue     = new List <string> ();
        int           i            = pos;

        for (; i < lines.Length; i++)
        {
            string[] cols = lines [i].Split(col_delim);
            if (cols [0].CompareTo("NPC") == 0)                // read in npc
            {
                npcs.Add(cols [1]);
            }
            else if (cols [0].CompareTo("DIALOGUE") == 0)                  // read in dialogue
            {
                whos_talking.Add(cols[1]);
                dialogue.Add(cols [2]);
            }
            else                 // otherwise, scene is done
            {
                break;
            }
        }
        scene_arr [curr_scene] = new CutScene(npcs.ToArray(),
                                              whos_talking.ToArray(), dialogue.ToArray());
        return(i);
    }
Example #12
0
    public override void createUIDescription(CutScene cutScene, SerializedObject serializedObject)
    {
        int i = 0;

        //display
        GUILayout.Label("<<Change Switch Value>>");
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Set ");
        switchNames.Clear();
        foreach (GameSwitch gameSwitch in cutScene.css.SwitchVariables)
        {
            switchNames.Add(gameSwitch.name);
        }


        selectedIndex = (int)EditorGUILayout.Popup(selectedIndex, switchNames.ToArray());
        if (cutScene.css.SwitchVariables.Count > 0)
        {
            targetSwitch = cutScene.css.SwitchVariables[selectedIndex];
        }

        GUILayout.Label(" to ");
        state = (SwitchState)EditorGUILayout.EnumPopup("", state);
        EditorGUILayout.EndHorizontal();
        //eventCallee = (MonoBehaviour)EditorGUILayout.ObjectField ("Object: ",eventCallee, typeof(MonoBehaviour),true);
        //functionName = EditorGUILayout.TextField ("FuncitonName: ",functionName);
    }
Example #13
0
    private void MissionButtonClicked(Mission mission)
    {
        currMission  = mission;
        currCutscene = null;

        MissionDetails.text = currMission.MissionName + "\n" + currMission.descript;
    }
Example #14
0
    public void TakeObject(string obj)
    {
        for (int i = 0; i < this.currentRoom.Children.Count; i++)
        {
            Room room = currentRoom.Children[i].Value;

            if (room.roomName.ToLower() == obj.ToLower() && room.isObject)
            {
                bool     playExit     = false;
                CutScene exitCutscene = currentRoom.Value.cutScene;
                if (CutSceneCanBePlayed() && this.currentRoom.Value.cutScene.trigger == CutSceneTrigger.ON_OBJECT_TAKEN)
                {
                    playExit = true;
                }
                AddLine("[" + room.roomName + "] OBTAINED. Exiting snapshot...");

                this.partsCollected++;
                if (partsCollected == 1)
                {
                    this.startRoom.Children[1].Value.accessible = true;
                }
                if (partsCollected == 2)
                {
                    this.startRoom.Children[2].Value.accessible = true;
                }
                ReturnToRoot();

                if (playExit)
                {
                    EnterCutScene(exitCutscene);
                }
            }
        }
    }
Example #15
0
 public void interacao()
 {
     if (fps.usouIPilha)
     {
         if (fps.usouIsqueiro)
         {
             bool viuCena = false;
             if (!viuCena)
             {
                 CutScene cutScene = FindObjectOfType(typeof(CutScene)) as CutScene;
                 cutScene.cena07();
             }
             else
             {
                 fps.exibirMensagemItem("Vá embora da ilha");
             }
         }
         else
         {
             fps.exibirMensagemItem("Investigue como acabar com a maldição");
         }
     }
     else
     {
         fps.exibirMensagemItem("Rádio sem Pilha");
     }
 }
Example #16
0
 public CutsceneDialoguInput(CutsceneController controller,
                             CutScene currentScene, CutSceneAction currentAction)
 {
     csController = controller;
     this.scene   = currentScene;
     this.action  = currentAction;
 }
Example #17
0
 public RelationshipSceneInputState(BaseManager baseManager, CutScene relationshipScene,
                                    CutsceneController dialogPanel)
     : base(baseManager)
 {
     this.relationshipScene = relationshipScene;
     this.dialogPanel       = dialogPanel;
 }
Example #18
0
 public void AddCutsceneToWatchList(CutScene scene)
 {
     if (cutscenes_watched.Contains(scene.GetKey()) == false)
     {
         cutscenes_watched.Add(scene.GetKey());
     }
 }
Example #19
0
        public static CutScene LoadCutScene(BinaryReader reader)
        {
            CutScene scene = new CutScene();

            scene.name   = reader.ReadString();
            scene.length = reader.ReadInt32();
            //read timed commands
            int tCommands = reader.ReadInt32();

            for (int i = 0; i < tCommands; i++)
            {
                TimedCommand c = new TimedCommand();
                c.time    = reader.ReadInt32();
                c.command = reader.ReadString();
            }
            //read NPCs
            int npcCount = reader.ReadInt32();

            for (int i = 0; i < npcCount; i++)
            {
                scene.NPCs.Add(LoadNPC(reader));
            }
            //read player actions
            int pActions = reader.ReadInt32();

            for (int i = 0; i < pActions; i++)
            {
                scene.playerActions.Add((Trainers.Action)reader.ReadByte());
            }

            return(scene);
        }
Example #20
0
    IEnumerator PlayCutScene(CutScene cutSceneIndex)
    {
        // disable gameplay, switch on movie camera
        // take the cutScenes[cutSceneIndex] and put it on the movie cube
        // play it.
        // switch off movie camera

        subtitle.text = "";
        EnableMovieCamera();

        MovieTexture cutscene = cutScenes[cutSceneIndex.index];

        AudioClip audio = null;
        if (cutScenesAudio.Length != 0){
            audio = cutScenesAudio[cutSceneIndex.index];
            Debug.Log ("has audio");
        }
        if (audio != null)
            moviePlayer.PlayMovie(cutscene,  audio);
        else
            moviePlayer.PlayMovie (cutscene);
        // wait till movie finishes playing
        while (!moviePlayer.IsFinishPlaying()){
            yield return null;
        }

        DisableMovieCamera();
    }
Example #21
0
    public override void createUIDescription(CutScene cutScene, SerializedObject serializedObject)
    {
        //display
        GUILayout.Label("<<Decision OnSwitch Node>>");
        //switch system here:
        listOfSwitches.Clear();
        listOfSwitches.Add("None");
        foreach (GameSwitch gameSwitch in cutScene.css.SwitchVariables)
        {
            listOfSwitches.Add(gameSwitch.name);
        }

        indexOfSwitch = EditorGUILayout.Popup("Switch to check: ", indexOfSwitch, listOfSwitches.ToArray());

        if (cutScene.css.SwitchVariables.Count > 0 && (indexOfSwitch - 1) >= 0)
        {
            decisionSwitch = cutScene.css.SwitchVariables [indexOfSwitch - 1];
        }
        else
        {
            decisionSwitch = null;
        }

        //Now, for the inpector variables
        cutSceneToGo = (CutScene)EditorGUILayout.ObjectField("Cut Scene To Jump if switch's true: ", cutSceneToGo, typeof(CutScene), true);
        if (cutSceneToGo == null)
        {
            EditorGUILayout.HelpBox("if the switch is false the cutscene will stop in this node and will not execute the next nodes. If true, continues normally executing.", MessageType.Info);
        }
        else
        {
            EditorGUILayout.HelpBox("If the switch is false, the execution of the cutscene continues normally. If the switch is true, then the target cutscene is going to be played next.", MessageType.Info);
        }
    }
Example #22
0
    void OnMouseDown()
    {
        if (Variables.ProjectHighScore == 1)
        {
            SceneIS           = Instantiate(ScenePF) as CutScene;
            SceneIS.SceneType = CutScene.SceneTypes.Project1st;
        }
        else if (Variables.ProjectHighScore == 2)
        {
            SceneIS           = Instantiate(ScenePF) as CutScene;
            SceneIS.SceneType = CutScene.SceneTypes.Project2nd;
        }
        else if (Variables.ProjectHighScore == 3)
        {
            SceneIS           = Instantiate(ScenePF) as CutScene;
            SceneIS.SceneType = CutScene.SceneTypes.Project3rd;
        }
        else
        {
            SceneIS           = Instantiate(ScenePF) as CutScene;
            SceneIS.SceneType = CutScene.SceneTypes.ProjectFail;
        }

        Destroy(gameObject);
    }
Example #23
0
    // Use this for initialization
    void Start()
    {
        cutScene = GetComponent<CutScene>();
        moveSound = GetComponent<AudioSource>();
        //Se guarda la posicion inicial del bloque
        //startPosition = this.transform.position;
        //Se calcula un offset ( distancia a la que se movera) en funcion al tamaño y direccion de apertura
        
        
        switch (openDirection)
        {
            case Direction.Down:
                offset = new Vector3(0, -moveDistance, 0);
                break;
            case Direction.Up:
                offset = new Vector3(0, moveDistance, 0);
                break;
            case Direction.Left:
                offset = new Vector3(-moveDistance, 0, 0);
                break;
            case Direction.Right:
                offset = new Vector3(moveDistance, 0, 0);
                break;

        }

        //Se guara la posicion final del bloque 
        //endPosition = startPosition + offset;


    }
Example #24
0
    public override void createUIDescription(CutScene cutScene, SerializedObject serializedObject)
    {
        FunctionWithParametersNode node = this;

        GUILayout.Label("<<Execute Function With Parameters>>");
        eventCallee = (EventsForNode)EditorGUILayout.ObjectField("EventsToTrigger: ", eventCallee, typeof(EventsForNode), true);
    }
Example #25
0
    public override void createUIDescription(CutScene cutScene, SerializedObject serializedObject)
    {
        SetActiveNode node = this;

        GUILayout.Label("<<SetActiveNode>>");
        gameObj = (GameObject)EditorGUILayout.ObjectField("Object: ", gameObj, typeof(GameObject), true);
        active  = EditorGUILayout.Toggle("Active: ", active);
    }
Example #26
0
    public override void createUIDescription(CutScene cutScene, SerializedObject serializedObject)
    {
        ExecuteFunctionNode node = this;

        GUILayout.Label("<<Execute Function>>");
        eventCallee  = (MonoBehaviour)EditorGUILayout.ObjectField("Object: ", eventCallee, typeof(MonoBehaviour), true);
        functionName = EditorGUILayout.TextField("FuncitonName: ", functionName);
    }
Example #27
0
 // Use this for references
 void Awake() {
     messageManager = GameObject.FindGameObjectWithTag("MessageManager").GetComponent<MessageManager>();
     cutScene = GetComponent<CutScene>();
     fearCutScene = targets[0].GetComponent<CutScene>();
     canvas = GetComponentInChildren<Canvas>().gameObject;
     animator = GetComponent<Animator>();
     ChangeTooltipStatus(TooltipManager.On);
 }
Example #28
0
 public CutsceneInputState(BoardManager boardManager, CutScene cs,
                           CutsceneController controller, CinematicStatus status)
     : base(boardManager)
 {
     cutscene     = Globals.campaign.GetCutsceneCopy(cs.GetKey());
     csController = controller;
     prevStatus   = status;
 }
Example #29
0
    public override void OnInspectorGUI()
    {
        cutScene = (CutScene)target;
        if(cutScene.nodeList == null){
            cutScene.nodeList = new List<CutSceneNodes>();
        }
        //CutSceneSystem
        cutScene.css = GameObject.Find("CutSceneSystem").GetComponent<CutSceneSystem>();
        cutScene.css = (CutSceneSystem)EditorGUILayout.ObjectField ("Cut Scene System",cutScene.css, typeof(CutSceneSystem), true);
        //draw bool options
        bool pauseGame = GUILayout.Toggle (cutScene.pauseGame,"Pause The Game",GUILayout.Width(300));
        cutScene.pauseGame = pauseGame;
        //draw buttons for adding and subtracting the cutscene sequence:
        GUILayout.BeginHorizontal ();
        if(GUILayout.Button("+Dialogo",GUILayout.Width(100))){
            cutScene.nodeList.Add(new Dialogue());
        }
        if(GUILayout.Button("+Animation",GUILayout.Width(100))){
            cutScene.nodeList.Add(new AnimationNode());
        }
        GUILayout.EndHorizontal ();

        //show list
        for(int i=0;i<cutScene.nodeList.Count;i++){
            CutSceneNodes nodeS = cutScene.nodeList[i];
            if(nodeS is Dialogue){
                Dialogue node = (Dialogue)nodeS;
                GUILayout.BeginVertical("box");
                if(GUILayout.Button("- Delete",GUILayout.Width(100))){
                    cutScene.nodeList.RemoveAt(i);
                }
                GUILayout.Label("<<Dialog>>");
                if(!cutScene.pauseGame){
                    node.target = (GameObject)EditorGUILayout.ObjectField ("Target: ",node.target, typeof(GameObject), true);
                    node.timeToLive = EditorGUILayout.FloatField("Time To Live",node.timeToLive);
                }
                GUILayout.BeginHorizontal();
                node.characterImage = (Sprite)EditorGUILayout.ObjectField ("Icon: ",node.characterImage, typeof(Sprite), true);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                GUILayout.Label("Text: ");
                node.text = EditorGUILayout.TextArea(((Dialogue)node).text,GUILayout.Width(300),GUILayout.Height(60));
                GUILayout.EndHorizontal();
            }else{
                AnimationNode node = (AnimationNode)nodeS;
                GUILayout.BeginVertical("box");
                if(GUILayout.Button("- Delete",GUILayout.Width(100))){
                    cutScene.nodeList.RemoveAt(i);
                }
                GUILayout.Label("<<Animation>>");
                node.animation = (Animation)EditorGUILayout.ObjectField ("Animation: ",node.animation, typeof(Animation), true);
                node.waitToFinish = EditorGUILayout.Toggle("Wait To Finish: ",node.waitToFinish);
            }
            nodeS.playWithNext = EditorGUILayout.Toggle("Play With Next: ",nodeS.playWithNext);
            GUILayout.EndVertical();
        }
    }
Example #30
0
    void Awake()
    {
        cutScene = GameObject.FindObjectOfType <CutScene>();
        texts    = GameObject.FindObjectOfType <TextsController>();

        state = GameState.LOADING_GAMEPLAY;

        ConnectionUtils.Instance.HideBanner();
    }
    public BoardDialogInputState(CutScene cs, BoardManager bm) : base(bm)
    {
        this.cs = cs;

        dialogpanel = bm.ui.dialogPanel;
        choicePanel = bm.ui.dialogChoice;

        GetNextNode();
    }
Example #32
0
    CutScene scene;                    // cutscene object

    // start cutscene
    public void startCutscene(CutScene i_scene)
    {
        scene     = i_scene;
        curr_line = 0;         // reset dialogue
        Debug.Log("NPCs in cutscene:");
        foreach (string npc in scene.npcs)
        {
            Debug.Log("  " + npc);
        }
        nextLine();
    }
Example #33
0
    private float PlayCutScene(GameMode mode)
    {
        _cutScene.gameObject.SetActive(true);
        // 컷씬 재생
        CutScene cutScene = _cutScene.GetComponent <CutScene>();
        float    dealy    = cutScene.Init(mode);

        cutScene.StartCoroutine("Animate");
        // 컷씬 종료
        return(dealy);
    }
Example #34
0
    public void CutsceneClicked(CutScene cutscene)
    {
        //baseManager.inputFSM.SwitchState(new RelationshipSceneInputState(baseManager, cutscene, dialogPanel));
        // switch to the general cutscene state
        CutScene cs = cutscene.Copy() as CutScene;

        baseManager.inputFSM.SwitchState(
            new CutsceneInputState(baseManager,
                                   cs, baseManager.baseUI.cutsceneController,
                                   CinematicStatus.RelationshipScene)
            );
    }
Example #35
0
    private void PrintCinematicBuff(string k)
    {
        TextButton missionButton = Instantiate(missionButtonPrefab, item_container.contentTransform);
        CutScene   cs            = Globals.campaign.GetCutsceneCopy(k);

        missionButton.ChangeText(cs.GetKey());

        buttonList.Add(missionButton);


        missionButton.button.onClick.AddListener(delegate { CutsceButtonClicked(cs); });
    }
    // Use this for initialization
    void Start()
    {
        cam = GameObject.Find("Main Camera");

        Sprite left = Resources.Load<Sprite>("Sprites/AndyAdvanceWars");
        Sprite right = Resources.Load<Sprite>("Sprites/AndyAdvanceWars-2");
        Sprite background = Resources.Load<Sprite>("Sprites/tmpbackground");

        cut = cam.AddComponent<CutScene>();
        box = cam.AddComponent<DialogueBox>();

        cut.SetSprites( left, right, background, cam.transform.position,false);

        lines = new List<string>();
        LoadLines("Assets/Resources/Dialogue/testdialogue.txt");
        box.SetText(lines[linenum]);
    }
Example #37
0
    /*
    public void OnEnable() {
        if(hasFadeCutScene) {
            ActivableFade.FadeInOutEvent += OpenDoorCutScene;
        }
        
    }

    public void OnDisable() {
        if(hasFadeCutScene) {
            ActivableFade.FadeInOutEvent -= OpenDoorCutScene;
        }
        
    }
    */

    // Use this for initialization
    void Start()
    {

        //Si se va a mostrar un cutscene
        cutScene = GetComponent<CutScene>();
        /*
        if (hasFadeCutScene) {
            activableFade = GetComponent<ActivableFade>();
        }
        */
        audioLoader = GetComponent<AudioLoader>();
        if(audioLoader) {
            openSound = audioLoader.GetSound("Open");
            closeSound = audioLoader.GetSound("Close");
        }


        //Se calcula un offset ( distancia a la que se movera) en funcion al tamaño y direccion de apertura
        Vector3 size = transform.localScale*4.2f;//REVISAR!!!!!!!!!!!!!!!!!!!//GetComponent<Renderer>().bounds.size;
        
        switch (openDirection)
        {
            case Direction.Down:
                offset = new Vector3(0, -size.y, 0);
                break;
            case Direction.Up:
                offset = new Vector3(0, size.y, 0);
                break;
            case Direction.Left:
                offset = new Vector3(-size.z, 0, 0);
                break;
            case Direction.Right:
                offset = new Vector3(size.z, 0, 0);
                break;

        }

        //Se guara la posicion final de la puerta cuando este abierta
        endPosition = startPosition + offset;


    }
Example #38
0
    // Use this for initialization
    void Start()
    {
        //Si se va a mostrar un cutscene
        cutScene = GetComponent<CutScene>();

        audioLoader = GetComponent<AudioLoader>();
        if(audioLoader) {
            activationSound = audioLoader.GetSound("Activation");
            deActivationSound = audioLoader.GetSound("Deactivation");

        }

        //Se calcula un offset ( distancia a la que se movera) en funcion al tamaño y direccion de apertura
        //Vector3 size = transform.localScale;//GetComponent<Renderer>().bounds.size;

        switch (openDirection)
        {
            case Direction.Down:
                offset = new Vector3(0, -movement, 0);
                break;
            case Direction.Up:
                offset = new Vector3(0, movement, 0);
                break;
            case Direction.Left:
                offset = new Vector3(-movement, 0, 0);
                break;
            case Direction.Right:
                offset = new Vector3(movement, 0, 0);
                break;

        }




    }
 /**************************************************************
  *
  * PRIVATE METHODS
  *
  **************************************************************/
 private void StartPlay(string cutSceneName)
 {
     if(pauseGame) {
         //Debug.Log("CutScenePlayer.StartPlay() pausing game");
         Pause.SetPaused(true);
         Screen.showCursor = true;
     }
     currentCutScene = FindCutscene(cutSceneName);
     currScreen = currentCutScene.GetFirst();
     if(!onlyPlayThis && !currentCutScene.archievement.Equals("")) {
         Archievements.Add(currentCutScene.archievement);
     }
     enabled = true;
     if(currentCutScene.syncFromMusic) {
         Debug.LogError("CutScenePlayer.StartPlay(): SyncWithMusic NOT IMPLEMENTED YET");
         FModManager.StartCutScene(this,cutSceneName);
     }
     else {
         FModManager.StartCutScene(cutSceneName);
         Invoke("NextScreen", currScreen.showTime);
     }
 }
    private void HandleCutSceneOver(bool cancelInvoke)
    {
        //Debug.Log("CutScenePlayer.HandleCutSceneOver()");
        //if(cancelInvoke) {
        CancelInvoke("NextScreen");
        //}

        if(!onlyPlayThis && currentCutScene.gameOverAfterThis) {
            // GAME OVER. Lets wrap up and load start screen
            currentCutScene = null;
            Application.LoadLevel("StartScreen");
        }
        else {
            if(!onlyPlayThis && !currentCutScene.nextCutScene.Equals("")) {
                //CancelInvoke("NextScreen");
                //Debug.Log("CutScenePlayer.HandleCutSceneOver():starting new cut-scene " + currentCutScene.nextCutScene);
                CutScenePlayer.Play(currentCutScene.nextCutScene);
            }
            else {
                // if we not have AICube the cut-scene is started from the main menu and we do not have characters
                // ready
                if(AICube) {
                    CharacterState pcState = (CharacterState)CharacterManager.GetPC().GetComponent("CharacterState");
                    pcState.GetCurrentArea().Entered(CharacterManager.GetPC());
                }

                currentCutScene = null;

                if(pauseGame) {
                    Pause.SetPaused(false);
                }
                enabled = false;

            }
        }
    }
Example #41
0
 void SetupCutScenes()
 {
     cutscene1 = new CutScene(0);
     cutscene2 = new CutScene(1);
 }
Example #42
0
 public static CutScene Get()
 {
     if (m_Instance == null)
         m_Instance = (CutScene)FindObjectOfType(typeof(CutScene));
     return m_Instance;
 }
Example #43
0
 void SetUpCutScenes()
 {
     cutscene1 = new CutScene(0);
     cutscene2 = new CutScene(1);
     cutscene3 = new CutScene(2);
     cutscene4 = new CutScene(3);
 }
 public void RunCutScene(CutScene cutscene, Transform startingLoc)
 {
     if (cutscene == CutScene.Crystalball)
         CrystalBallCS(startingLoc);
 }
Example #45
0
    /// <summary>
    /// Handle Event: OnQuestCompleted
    /// </summary>
    public void OnQuestCompleted()
    {
        if (miniGame != null)
        {
            ResourceManager.UnloadAsset(miniGame.gameObject);
            Destroy(miniGame.gameObject);
        }

        Destroy(conversationTree.gameObject);
        conversationTree = null;

        Destroy(cutScene.gameObject);
        cutScene = null;

        Resources.UnloadUnusedAssets();

        InputManager.Instance.ReceivedUIInput();
        Player.instance.PlayRewardPortrait(playerRewardPortrait, missingToy, foundToyColor, celebratingTime);

        //Add interaction Completed in interaction table
        //RecordAnswers("Emotions");
        //RecordAnswers("Comprehension");
        //RecordAnswers("ConversationStart");
        //RecordAnswers("MaintainConversation");
        //RecordAnswers("ProblemSolving");
        interactionID = MainDatabase.Instance.getIDs("Select Max(InteractionID) from Interaction;");
        MainDatabase.Instance.UpdateSql("UPDATE Interaction SET Completed='True' WHERE InteractionID=" + interactionID + ";");
        int NPCID = MainDatabase.Instance.getIDs("Select NPCID from Interaction where InteractionID=" + interactionID + ";");
        //changing the status of NPC to completed by assigning to 1
        MainDatabase.Instance.ChangeUserNPCStatus(ApplicationState.Instance.userID, NPCID, 1);
        //Adding toy to userToy table.
        DBToyInfo toyAchieved = MainDatabase.Instance.getToyInfoByInteractionID(interactionID);
        MainDatabase.Instance.InsertSql("INSERT INTO UserToy (UserID,ToyID,InteractionID) VALUES ('" + ApplicationState.Instance.userID + "','"+toyAchieved.ToyID+ "','"+interactionID+ "');");

        // Remove glowing effect around NPC
        RemoveGlow();
        Markers.Instance.OnQuestCompleted(toyWorldPosition, NPCs.Instance.GetNpcID(this));
        interactingState = InteractingState.COMPLETED_TASK;
        NPCs.Instance.UpdateNPCStatus();

        NPCs.Instance.EnableInput();
        GameManager.Instance.PrepareUserPrompt();
    }
Example #46
0
 /// <summary>
 /// todo: send a copy of the room (GameObjects, ChangeRoom() etc)
 /// </summary>
 public virtual void Update(CutScene cutscene)
 {
 }
Example #47
0
    // Update is called once per frame
    public void StartInteraction()
    {
        // If NPC is waiting for the player to interact
        if (interactingState == InteractingState.WAITING_PLAYER)
        {
            if (Player.instance.talkToNPC)
            {
                // and it's the first time he has been close to the NPC
                if (Player.instance.interactionState != Player.InteractionState.NEAR_NPC)
                {
                    GameManager.Instance.CancelUserPrompt();
                    Player.instance.talkToNPC = false;
                    // Hide Sherlocks' dialogue window
                    Sherlock.Instance.StartCoroutine(Sherlock.Instance.SetDialogue(null));
                    // Notify player that is near the NPC
                    Player.instance.interactionState = Player.InteractionState.NEAR_NPC;

                    Player.instance.SetCutscene(true);

                    Player.instance.interactingNPC = this;
                    // Enable the input on the NPCs
                    NPCs.Instance.EnableInput();

                    GameObject cutSceneGO = null;
                    // If there is an event to be triggered when player is near the NPC
                    if (nearPlayerEvent != null)
                    {
                        // Load cut scene prefab and instantiate it
                        GameObject cutScenePrefab = ResourceManager.LoadNPCCutScene(NPCName());
                        if (cutScenePrefab != null)
                        {
                            cutSceneGO = Instantiate(cutScenePrefab) as GameObject;
                            cutSceneGO.transform.parent = GameManager.Instance.UIPanel;
                            cutScene = cutSceneGO.GetComponent<CutScene>();

                            // Update references in cut scene to NPC
                            nearPlayerEvent.ClearObjectsToNotify();
                            nearPlayerEvent.AddObjectToNotify(cutSceneGO);

                            foreach (SCEvent cutSceneEvent in cutSceneGO.GetComponentsInChildren<SCEvent>(true))
                            {
                                List<GameObject> gameObjects = cutSceneEvent.gameObjectsToNotify;
                                for (int i = 0, count = gameObjects.Count; i < count; i++)
                                    if (gameObjects [i] == null)
                                    {
                                        gameObjects [i] = this.gameObject;
                                    }
                            }

                            // Trigger it
                            nearPlayerEvent.TriggerEvent(true);
                        } else
                        {
                            Debug.LogWarning("No cut scene prefab found for " + NPCName());
                        }
                    }

                    // Load conversation prefab and instantiate it
                    GameObject conversationPrefab = ResourceManager.LoadNPCConversation(NPCName());
                    if (conversationPrefab != null)
                    {
                        GameObject conversationRoot = Instantiate(conversationPrefab) as GameObject;
                        conversationRoot.transform.parent = this.transform;
                        conversationTree = conversationRoot.GetComponent<ConversationTree>();

                        // Update references in conversation events to NPC
                        foreach (SCEvent conversationEvent in conversationRoot.GetComponentsInChildren<SCEvent>(true))
                        {
                            int nullGO = 0;
                            List<GameObject> gameObjects = conversationEvent.gameObjectsToNotify;
                            for (int i = 0, count = gameObjects.Count; i < count; i++)
                                if (gameObjects [i] == null)
                                {
                                    nullGO++;
                                    if (nullGO == 2)
                                        gameObjects [i] = cutSceneGO;
                                    else
                                        gameObjects [i] = this.gameObject;
                                }
                        }

                        GameObject voiceOversPrefab = ResourceManager.LoadNPCVoiceOver(NPCName(), ApplicationState.Instance.selectedCharacter);
                        DialogueVoiceOver voiceOver =  (DialogueVoiceOver) ((voiceOversPrefab != null) ? voiceOversPrefab.GetComponent<DialogueVoiceOver>() : null);
                        // Upate owner of each dialogue to NPC
                        foreach (Dialogue dialogue in conversationRoot.GetComponentsInChildren<Dialogue>(true))
                        {
                            dialogue.owner = this;

                            if (voiceOver != null && dialogue.voiceOverID != DialogueVoiceOver.VoiceOverID.NATIVE && dialogue.voiceOverID != DialogueVoiceOver.VoiceOverID.NONE)
                            {
                                dialogue.voiceOver = voiceOver.RetrieveVoiceOverAudio(dialogue.voiceOverID);
                            }
                        }

                        foreach (Reply reply in conversationRoot.GetComponentsInChildren<Reply>(true))
                        {
                            if (voiceOver != null && reply.voiceOverID != DialogueVoiceOver.VoiceOverID.NATIVE && reply.voiceOverID != DialogueVoiceOver.VoiceOverID.NONE)
                            {
                                reply.voiceOver = voiceOver.RetrieveVoiceOverAudio(reply.voiceOverID);
                            }
                        }

                        voiceOversPrefab = null;
                        Resources.UnloadUnusedAssets();
                    } else
                    {
                        Debug.LogWarning("No conversation prefab found for " + NPCName());
                    }
                }
            }
            // else if the player is not close to the NPC but the player was interacting with the NPC before
            else if (Player.instance.interactingNPC == this)
            {
                // Notify plyer that he is away from the NPC
                Player.instance.interactionState = Player.InteractionState.NONE;
                Player.instance.interactingNPC = null;
                NPCs.Instance.EnableInput();
                //Player.instance.SetGoToCharacter(true);
                Player.instance.Navigate(transform.position, false);
            } else
            {
                //Player.instance.interactionBubble.IgnoreNPC();
                //Player.instance.SetGoToCharacter(true);
                Player.instance.SetInteractiveBubbleNPC(this);
                Player.instance.Navigate(transform.position, false);
            }
        } else
        {
            if (interactingState == InteractingState.INTERACTING_WITH_PLAYER || interactingState == InteractingState.TALKING_PLAYER)
            {
                //if (Player.instance.PlayerDistance(transform.position) < 3f)
                if (Player.instance.GetDistance(this.transform.position) < 0.02f)
                {
                    // Then talk with the player
                    Player.instance.TalkNPC(this);
                }
                else
                {
                    //Player.instance.SetGoToCharacter(true);
                    Player.instance.Navigate(transform.position, false);
                }
            }
        }
    }
Example #48
0
 // Use this for initialization
 void Start()
 {
     scene = GameObject.FindObjectOfType(typeof(CutScene)) as CutScene;
 }
Example #49
0
 public ScriptPiece(UILabel subtitleLabel, string text, Talking talking, CutScene cutSceneIndex)
 {
     this.text = text;
     this.talking = talking;
     this.cutSceneIndexAfter = cutSceneIndex;
     //this.playCutSceneMethod = parent.PlayCutScene;
     this.subtitleLabel = subtitleLabel;
     AdjustTalkDelay(text);
     if (text == null)
         talkDelay = 0f;
 }
Example #50
0
 public ScriptPieceDecision(UILabel subtitleLabel, string text, Talking talking, CutScene cutSceneAIndex,CutScene cutSceneBIndex)
     : base(subtitleLabel, text, talking)
 {
     storyDecision = Decision.NONE;
     cutsceneA = cutSceneAIndex;
     cutsceneB = cutSceneBIndex;
 }