예제 #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();
        }
    }
예제 #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();
        }
    }
예제 #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();
    }
예제 #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());
    }
예제 #5
0
    public override void execute(SequencePlayer player)
    {
        myPlayer = player;

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

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

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

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

        myPlayer.callBackFromCommand();
    }
예제 #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();
    }
예제 #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);
    }
예제 #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();
    }
예제 #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();
    }
예제 #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();
    }
예제 #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();
    }
예제 #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();
    }
예제 #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();
    }
예제 #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);
    }
예제 #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();
    }
예제 #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();
    }
예제 #19
0
    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();
                }
            }
        }
    }
예제 #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();
    }
예제 #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();
    }
예제 #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();
    }
예제 #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();
    }
예제 #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();
    }
예제 #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();
    }