Example #1
0
    override public void execute(SequencePlayer player)
    {
        myPlayer = player;

        if (player.inRewindMode)
        {
            undo();
        }
        else
        {
            Transform target = sequencerData.targets [lastSelectedWho].target.transform;
            Transform from   = null;
            if (useFrom)
            {
                from = sequencerData.targets [lastSelectedFrom].target.transform;
            }
            else
            {
                from             = target.transform;
                previousPosition = from.localPosition;
            }
            Transform to = sequencerData.targets [lastSelectedTo].target.transform;

            wasActiveAtStart = target.gameObject.activeInHierarchy;
            target.gameObject.SetActive(true);

            target.transform.localPosition = new Vector3(from.localPosition.x, target.transform.localPosition.y, target.transform.localPosition.z);

            Vector3 finalPos = new Vector3(to.localPosition.x, target.transform.localPosition.y, target.transform.localPosition.z);

            if (time == 0)
            {
                target.localPosition = finalPos;
                if (waitForEndOfTween)
                {
                    myPlayer.callBackFromCommand();
                }
            }
            else
            {
                tween = HOTween.To(target, time, new TweenParms().NewProp("localPosition", finalPos).OnComplete(onTweenComplete));
            }
        }

        if (!waitForEndOfTween)
        {
            myPlayer.callBackFromCommand();
        }
    }
Example #2
0
    override public void execute(SequencePlayer player)
    {
        myPlayer = player;

        if (player.inRewindMode)
        {
            undo();
        }
        else
        {
            if (tween != null && !tween.isComplete)
            {
                tween.Kill();
            }

            Transform target = sequencerData.targets [lastSelectedWho].target.transform;
            previousPosition = target.transform.localPosition;

            if (useTo)
            {
                Transform to = sequencerData.targets [lastSelectedTo].target.transform;
                tween = HOTween.To(target, time, new TweenParms().NewProp("localPosition", new Vector3(to.localPosition.x, target.transform.localPosition.y, target.transform.localPosition.z)).OnComplete(onExecuteCompleteEvt));
            }
            else
            {
                onExecuteComplete();
            }
        }

        if (!waitForEndOfTween)
        {
            myPlayer.callBackFromCommand();
        }
    }
Example #3
0
    public override void execute(SequencePlayer player)
    {
        myPlayer = player;

        if (player.inRewindMode)
        {
            undo();
        } else
        {
            GameObject target = sequencerData.getTargetModel(targetName).target;
            VN_CharBase charcomp = target.GetComponent<VN_CharBase>();

            string[] attireNames = charcomp.getAttireNames();
            string[] expressionNames = charcomp.getExpressionNames();

            if (attireNames != null && attireNames.Length > 0)
                prevAttireName = charcomp.getCurrentAttireName();
            if (expressionNames != null && expressionNames.Length > 0)
                prevExpressionName = charcomp.getCurrentExpressionName();

            charcomp.setAttire(attireName);
            charcomp.setExpression(expressionName, false);
        }

        myPlayer.callBackFromCommand();
    }
Example #4
0
    public override void execute(SequencePlayer player)
    {
        myPlayer = player;

        if (player.inRewindMode)
        {
            undo();
        } else
        {
            if (audioClipName != SoundManager.nullSoundName && audioClipName.Length != 0 && audioClipName != "" && audioClipName != " ")
            {
                audioClip = SoundManager.Get().getSfxByName(audioClipName);
            } else if (SoundManager.Get().getSfxByName(audioClip.name) == null)
            {
                SoundManager.Get().sfxClips.Add(audioClip);
                audioClipName = audioClip.name;
            }

            SoundManager.Get().playSfx(audioClipName, volume);
        }

        if (!waitForAudioClipEnd || player.inRewindMode)
            myPlayer.callBackFromCommand();
        else
            myPlayer.StartCoroutine(doAudioWaitFinish());
    }
Example #5
0
    public override void execute(SequencePlayer player)
    {
        myPlayer = player;

        myPlayer.inRewindMode = false;
        myPlayer.callBackFromCommand(true);
    }
Example #6
0
    public override void execute(SequencePlayer player)
    {
        myPlayer = player;

        if (player.inRewindMode)
        {
            undo();
        } else
        {
            SoundManager.Get().stopAllSfx();
        }

        myPlayer.callBackFromCommand();
    }
Example #7
0
    override public void execute(SequencePlayer player)
    {
        myPlayer = player;

        if (player.inRewindMode)
        {
            undo();
        }
        else
        {
            SoundManager.Get().stopAllSfx();
        }

        myPlayer.callBackFromCommand();
    }
Example #8
0
    public override void execute(SequencePlayer player)
    {
        myPlayer = player;

        if (player.inRewindMode)
        {
            undo();
        } else
        {
            GameObject target = sequencerData.getTargetModel(targetName).target;
            VN_CharBase charcomp = target.GetComponent<VN_CharBase>();
            charcomp.flip();
        }

        myPlayer.callBackFromCommand();
    }
Example #9
0
    public override void execute(SequencePlayer player)
    {
        myPlayer = player;

        if (audioClip != null)
        {
            if (SoundManager.Get().getSfxByName(audioClip.name) == null)
                SoundManager.Get().sfxClips.Add(audioClip);
            SoundManager.Get().playSfx(audioClip.name, volume);
        }

        GameObject target = sequencerData.targets [sequencerData.getIndexOfTarget(speakerTargetName)].target;
        myPlayer.dialogController.showDialog(parseTextForVarsAndBB(text), target, bubbleXOffset);

        myPlayer.inRewindMode = false;
        myPlayer.callBackFromCommand(true);
    }
Example #10
0
    //Execute runs when the player.play() method is called, basically when we've switched into this command
    public override void execute(SequencePlayer player)
    {
        //cache the player, pretty important
        myPlayer = player;

        //if executed this command while rewinding then do something
        if (myPlayer.inRewindMode)
        {
            //usually undo whatever the command did
            undo();
        } else
        {
            //do whatever the command does here
        }

        //we are done with the command, let the player know, if we dont do this then we are stuck waiting here
        myPlayer.callBackFromCommand();
    }
Example #11
0
    public override void execute(SequencePlayer player)
    {
        myPlayer = player;

        if (player.inRewindMode)
        {
            undo();
        } else
        {
            previousPlayingMusicClipName = SoundManager.Get().getCurrentMusicClipName();
            previousFadeTime = SoundManager.Get().fadeTime;
            previousVolume = SoundManager.Get().getCurrentMusicClipVolume();
            SoundManager.Get().fadeTime = fadeTime;
            SoundManager.Get().stopMusic();
        }

        myPlayer.callBackFromCommand();
    }
Example #12
0
    public override void execute(SequencePlayer player)
    {
        myPlayer = player;

        if (myPlayer.inRewindMode)
        {
            undo();
        } else
        {
            if (myPlayer.runningTimeVariablesDictionary.ContainsKey(variableName))
                previousValue = myPlayer.runningTimeVariablesDictionary [variableName];
            else
                myPlayer.runningTimeVariablesDictionary.Add(variableName, "");

            myPlayer.inputController.showInputFor(variableName, myPlayer);
        }

        myPlayer.callBackFromCommand();
    }
Example #13
0
    //Execute runs when the player.play() method is called, basically when we've switched into this command
    override public void execute(SequencePlayer player)
    {
        //cache the player, pretty important
        myPlayer = player;

        //if executed this command while rewinding then do something
        if (myPlayer.inRewindMode)
        {
            //usually undo whatever the command did
            undo();
        }
        else
        {
            //do whatever the command does here
        }

        //we are done with the command, let the player know, if we dont do this then we are stuck waiting here
        myPlayer.callBackFromCommand();
    }
Example #14
0
    override public void execute(SequencePlayer player)
    {
        myPlayer = player;

        if (player.inRewindMode)
        {
            undo();
        }
        else
        {
            previousPlayingMusicClipName = SoundManager.Get().getCurrentMusicClipName();
            previousFadeTime             = SoundManager.Get().fadeTime;
            previousVolume = SoundManager.Get().getCurrentMusicClipVolume();
            SoundManager.Get().fadeTime = fadeTime;
            SoundManager.Get().stopMusic();
        }

        myPlayer.callBackFromCommand();
    }
Example #15
0
    override public void execute(SequencePlayer player)
    {
        myPlayer = player;

        if (player.inRewindMode)
        {
            undo();
        }
        else
        {
            if (SoundManager.Get().getSfxByName(audioClip.name) == null)
            {
                SoundManager.Get().sfxClips.Add(audioClip);
            }
            SoundManager.Get().playSfx(audioClip.name, volume);
        }

        myPlayer.callBackFromCommand();
    }
Example #16
0
    override public void execute(SequencePlayer player)
    {
        myPlayer = player;

        if (audioClip != null)
        {
            if (SoundManager.Get().getSfxByName(audioClip.name) == null)
            {
                SoundManager.Get().sfxClips.Add(audioClip);
            }
            SoundManager.Get().playSfx(audioClip.name, volume);
        }

        GameObject target = sequencerData.targets [speakerTargetIndex].target;

        myPlayer.dialogController.showDialog(text, target, bubbleXOffset);

        myPlayer.inRewindMode = false;
        myPlayer.callBackFromCommand(true);
    }
Example #17
0
    override public void execute(SequencePlayer player)
    {
        myPlayer = player;

        if (player.inRewindMode)
        {
            undo();
        }
        else
        {
            GameObject  target   = sequencerData.targets [targetIndexList].target;
            VN_CharBase charcomp = target.GetComponent <VN_CharBase>();

            prevAttireIndex    = charcomp.getCurrentAttire();
            prevExpressionName = charcomp.getCurrentExpressionName();

            charcomp.setAttire(attireListIndex);
            charcomp.setExpression(expressionName, false);
        }

        myPlayer.callBackFromCommand();
    }
Example #18
0
    override public void execute(SequencePlayer player)
    {
        myPlayer = player;

        if (player.inRewindMode)
        {
            undo();
        }
        else
        {
            previousPlayingMusicClipName = SoundManager.Get().getCurrentMusicClipName();
            previousVolume = SoundManager.Get().musicVolume;

            if (SoundManager.Get().getMusicByName(audioClip.name) == null)
            {
                SoundManager.Get().musicClips.Add(audioClip);
            }
            SoundManager.Get().playMusic(audioClip.name, volume);
        }

        myPlayer.callBackFromCommand();
    }
    public override void execute(SequencePlayer player)
    {
        myPlayer = player;
        if (player.inRewindMode)
            undo();
        else
        {
            //evaluate expressions and jump to winning one
            if (expressionList.Count == 0)
            {
                Debug.LogWarning("Expression Jump with zero expressions, will continue to next command!");
                myPlayer.callBackFromCommand();
            } else
            {
                int foundIndex = -1;
                for (int i = 0; i < expressionList.Count; i++)
                {
                    myPlayer.gameObject.GetComponent("Jurassic").SendMessage("evalBool", parseTextForVars(expressionList [i]));
                    if (myPlayer.lastEvalResultBool)
                    {
                        foundIndex = i;
                        break;
                    }
                }

                if (foundIndex > -1)
                {
                    myPlayer.jumpToScene(sectionNameList [foundIndex], commandIndexList [foundIndex]);
                } else
                {
                    Debug.LogWarning("Expression Jump none of the expressions evaluated to true, will continue to next command!");
                    myPlayer.callBackFromCommand();
                }
            }
        }
    }
Example #20
0
    public override void execute(SequencePlayer player)
    {
        myPlayer = player;

        if (player.inRewindMode)
        {
            undo();
        } else
        {
            //clear previous
            positions = new List<Vector3>();
            visibilitys = new List<bool>();
            attires = new List<int>();
            expressions = new List<string>();

            //attempt save state:

            //music
            musicClipName = SoundManager.Get().getCurrentMusicClipName();
            musicClipVolume = SoundManager.Get().getCurrentMusicClipVolume();

            SoundManager.Get().stopMusic();

            //characters (visible, pos, attire, expression)
            foreach (SequencerTargetModel model in myPlayer.sequencerData.targets)
            {
                if (model.target == null)
                {
                    positions.Add(Vector3.zero);
                    visibilitys.Add(false);
                    attires.Add(0);
                    expressions.Add("none");
                    continue;
                }

                positions.Add(model.target.transform.position);
                visibilitys.Add(model.target.activeInHierarchy);
                VN_CharBase hasCharComp = model.target.GetComponent<VN_CharBase>();

                if (hasCharComp != null)
                {
                    attires.Add(hasCharComp.getCurrentAttire());
                    expressions.Add(hasCharComp.getCurrentExpressionName());
                } else
                {
                    attires.Add(-1);
                    expressions.Add("");
                }

                //TODO: in future use type instead? backgrounds are characters too ?
                if (hasCharComp != null)
                    model.target.SetActive(false);
            }

            //TODO: future: vars, flip
        }

        myPlayer.callBackFromCommand();
    }
Example #21
0
    public override void execute(SequencePlayer player)
    {
        myPlayer = player;

        if (player.inRewindMode)
        {
            undo();
        } else
        {
            if (tween != null && !tween.isComplete)
            {
                tween.Kill();
            }

            Transform target = sequencerData.targets [sequencerData.getIndexOfTarget(lastSelectedWho)].target.transform;
            previousPosition = target.transform.localPosition;

            if (useTo)
            {
                Transform to = sequencerData.targets [sequencerData.getIndexOfTarget(lastSelectedTo)].target.transform;
                tween = HOTween.To(target, time, new TweenParms().NewProp("localPosition", new Vector3(to.localPosition.x, target.transform.localPosition.y, target.transform.localPosition.z)).OnComplete(onExecuteCompleteEvt));
            } else
            {
                onExecuteComplete();
            }
        }

        if (!waitForEndOfTween)
            myPlayer.callBackFromCommand();
    }
Example #22
0
    public override void execute(SequencePlayer player)
    {
        myPlayer = player;

        if (player.inRewindMode)
        {
            undo();
        } else
        {
            Transform target = sequencerData.targets [sequencerData.getIndexOfTarget(lastSelectedWho)].target.transform;
            Transform from = null;
            if (useFrom)
                from = sequencerData.getTargetModel(lastSelectedFrom).target.transform;
            else
            {
                from = target.transform;
                previousPosition = from.localPosition;
            }
            Transform to = sequencerData.getTargetModel(lastSelectedTo).target.transform;

            wasActiveAtStart = target.gameObject.activeInHierarchy;
            target.gameObject.SetActive(true);

            target.transform.localPosition = new Vector3(from.localPosition.x, target.transform.localPosition.y, target.transform.localPosition.z);

            Vector3 finalPos = new Vector3(to.localPosition.x, target.transform.localPosition.y, target.transform.localPosition.z);

            if (time == 0)
            {
                target.localPosition = finalPos;
                if (waitForEndOfTween)
                {
                    myPlayer.callBackFromCommand();
                }
            } else
                tween = HOTween.To(target, time, new TweenParms().NewProp("localPosition", finalPos).OnComplete(onTweenComplete));
        }

        if (!waitForEndOfTween)
            myPlayer.callBackFromCommand();
    }
Example #23
0
    override public void execute(SequencePlayer player)
    {
        myPlayer = player;

        if (player.inRewindMode)
        {
            undo();
        }
        else
        {
            //clear previous
            positions   = new List <Vector3>();
            visibilitys = new List <bool>();
            attires     = new List <int>();
            expressions = new List <string>();

            //attempt save state:

            //music
            musicClipName   = SoundManager.Get().getCurrentMusicClipName();
            musicClipVolume = SoundManager.Get().getCurrentMusicClipVolume();

            SoundManager.Get().stopMusic();

            //characters (visible, pos, attire, expression)
            foreach (SequencerTargetModel model in myPlayer.sequencerData.targets)
            {
                if (model.target == null)
                {
                    positions.Add(Vector3.zero);
                    visibilitys.Add(false);
                    attires.Add(0);
                    expressions.Add("none");
                    continue;
                }

                positions.Add(model.target.transform.position);
                visibilitys.Add(model.target.activeInHierarchy);
                VN_CharBase hasCharComp = model.target.GetComponent <VN_CharBase>();

                if (hasCharComp != null)
                {
                    attires.Add(hasCharComp.getCurrentAttire());
                    expressions.Add(hasCharComp.getCurrentExpressionName());
                }
                else
                {
                    attires.Add(-1);
                    expressions.Add("");
                }

                //TODO: in future use type instead? backgrounds are characters too ?
                if (hasCharComp != null)
                {
                    model.target.SetActive(false);
                }
            }

            //future: vars
        }

        myPlayer.callBackFromCommand();
    }
Example #24
0
    public override void execute(SequencePlayer player)
    {
        myPlayer = player;

        if (player.inRewindMode)
        {
            undo();
        } else
        {
            previousPlayingMusicClipName = SoundManager.Get().getCurrentMusicClipName();
            previousVolume = SoundManager.Get().musicVolume;

            if (audioClipName != SoundManager.nullSoundName && audioClipName.Length != 0 && audioClipName != "" && audioClipName != " ")
            {
                audioClip = SoundManager.Get().getMusicByName(audioClipName);
            } else if (SoundManager.Get().getMusicByName(audioClip.name) == null)
            {
                SoundManager.Get().musicClips.Add(audioClip);
                audioClipName = audioClip.name;
            }

            SoundManager.Get().playMusic(audioClipName, volume);
        }

        myPlayer.callBackFromCommand();
    }
Example #25
0
    public override void execute(SequencePlayer player)
    {
        myPlayer = player;

        if (myPlayer.inRewindMode)
        {
            undo();
        } else
        {
            string result = "0";
            if (typeIndex == 0)
                result = variableValue;

            if (myPlayer.runningTimeVariablesDictionary.ContainsKey(variableName))
            {
                previousValue = myPlayer.runningTimeVariablesDictionary [variableName];
            } else
            {
                myPlayer.runningTimeVariablesDictionary.Add(variableName, result);
                previousValue = result;
            }

            if (typeIndex == 1)
            {
                myPlayer.gameObject.GetComponent("SequencerEvalExpression").SendMessage("evalInt", parseTextForVars(variableValue));
                result = myPlayer.lastEvalResultInt.ToString();
            } else if (typeIndex == 2)
            {
                myPlayer.gameObject.GetComponent("SequencerEvalExpression").SendMessage("evalFloat", parseTextForVars(variableValue));
                result = myPlayer.lastEvalResultFloat.ToString();
            }

            myPlayer.runningTimeVariablesDictionary [variableName] = result;
        }

        myPlayer.callBackFromCommand();
    }