void FindCutsceneActorsInScene()
 {
     CutsceneCharacter[] cutsceneActors = GameObject.FindObjectsOfType <CutsceneCharacter> ();
     for (int i = cutsceneIndex; i < cutscene.Length; i++)
     {
         CutsceneStep step = cutscene[i];
         if (step.action.action == CutsceneStep.StepAction.Action.MoveCharacter || step.action.action == CutsceneStep.StepAction.Action.RotateCharacter)
         {
             bool foundHim = false;
             for (int j = 0; !foundHim && j < cutsceneActors.Length; j++)
             {
                 if (step.action.actorId == cutsceneActors[j].id)
                 {
                     step.action.Character = cutsceneActors[j];
                     foundHim = true;
                 }
             }
             if (!foundHim)
             {
                 Debug.LogWarning("CutsceneManager(" + gameObject.name + ")/RegisterCutsceneActors () : Didn't find cutsceneCharacter for stepIndex " + i);
             }
         }
     }
 }
Beispiel #2
0
	bool IsDone(CutsceneStep step) {
		if (Time.timeScale == 0)
			return false;
		
		switch (step.action) {
		// case CutsceneStep.Action.WaitSound:
		// 	//plugin.EndSoundInputSound();
		// 	return plugin.isSounded;
			
		default:
			return step.isDone;
		}
	}
Beispiel #3
0
	public bool DoStep(CutsceneStep step) {
		if (step == null) {
			Debug.Log ("DoStep step "+step);
			return true;
		}

		if (step.action == CutsceneStep.Action.WaitTouch && step.intVal > 0) {
			if (IsBool(step.intVal, step.actor.name)) {
				step.actor.WaitTouch(0, false);
				return false;
			}
		}
		
		Debug.Log ("DoStep step.action "+step.action);
		switch (step.action) {	
		case CutsceneStep.Action.GameLog://GameStart, GameEnd, ChapterStart, ChapterEnd
			if( step.intVal == 0 )//GameStart
			{
				World.SendGameLog("G",step.intVal2,true );//type, id, bSuccess
			}
			else if( step.intVal == 1 )//GameEnd
			{
				World.SendGameLog("G",step.intVal2,false );//type, id, bSuccess
			}
			else if( step.intVal == 2 )//ChapterStart
			{
				World.EpisodeChapterState( true );
			}
			else if( step.intVal == 3 )//ChapterEnd
			{
				World.EpisodeChapterState( false );
			}
			break;
		case CutsceneStep.Action.Caption:
			if( World.langCaptionIdx != -1 )
			{
				if (step.intVal > 0 && dialogs[World.langCaptionIdx].Length > step.intVal) {
					Debug.Log ("======World.langCaptionIdx = " + World.langCaptionIdx);
					//gbl.DisplaySubtitle(dialogs[World.langCaptionIdx][step.intVal].caption, step.actor);
				}
			}
			break;
		case CutsceneStep.Action.TalkTo:
		case CutsceneStep.Action.SpeechTo:

			if (step.intVal2 > 0)
				step.actor.Action(step.intVal2, false ,null);
			if( World.langCaptionIdx != -1 )
			{
//				Debug.Log ("World.langCaptionIdx "+World.langCaptionIdx);
//				Debug.Log ("step.intVal "+step.intVal);
//				Debug.Log ("dialogs "+dialogs);
				if( dialogs != null )
				{
					if (step.intVal > 0 && dialogs[World.langCaptionIdx].Length > step.intVal) {
						
//						Debug.Log ("gbl.DisplaySubtitle ");
						Debug.Log ("======World.langCaptionIdx = " + World.langCaptionIdx);
						//gbl.DisplaySubtitle(dialogs[World.langCaptionIdx][step.intVal].caption, step.actor);
						if (step.floatVal == 0)
						{
							if( World.langIdx != -1 )
							{
//								Debug.Log ("World.langIdx "+World.langIdx);
//								Debug.Log ("step.intVal "+step.intVal);
								if (step.intVal > 0 && dialogs[World.langIdx].Length > step.intVal) 
									step.actor.TalkTo(dialogs[World.langIdx][step.intVal].clip, step.target, step.action);
							}
						}
					}
				}
			}
			else
			{
				if (step.intVal > 0 ) {
					if (step.floatVal == 0)
						step.actor.TalkTo(dialogs[World.langIdx][step.intVal].clip, step.target, step.action);
				}
			}
			if (step.floatVal > 0) {
//				Debug.Log ("step.actor.LipTo ");
				step.actor.LipTo(step.floatVal, step.target, step.action);
			}
			step.actor.NextLoopAction(step.boolVal);
			break;
			
		case CutsceneStep.Action.Action:
			AudioClip clip = null;
			if (step.intVal2 > 0 && dialogs[World.langIdx].Length > step.intVal2)
				clip = dialogs[World.langIdx][step.intVal2].clip;
			step.actor.Action(step.intVal,step.boolVal2, clip);
			step.actor.NextLoopAction(step.boolVal);
			break;
			
		case CutsceneStep.Action.LoadScene:
			//World.loadedLevelName = step.strVal;
			
			
			Debug.Log ("CutsceneStep.Action.LoadScene : "+step.strVal);
			//Episode Ending Check
			if( World.loadedLevelName.Contains("_ending") )
				World.EpisodeFinish();
			
			//English Episode Ending Check
			if( step.strVal.Contains("GoToStart") )
			{
				if( World.loadedLevelName.Contains("episode_e") ||World.loadedLevelName.Contains("review_e") )
					World.EpisodeFinish();
				else if( Application.loadedLevelName.Contains("episode_e") || Application.loadedLevelName.Contains("review_e"))
					World.EpisodeFinish();
			}
			if(step.obj != null )
				Global.SetScene(step.obj as CutsceneMgr); Debug.Log("step.obj = "+step.obj);
			World.sceneParam = step.strVal2;Debug.Log("step.strval2 : "+step.strVal2);
			Global.LoadScene(step.strVal, step.intVal);Debug.Log("step.strval : "+step.strVal+", step.intval : "+step.intVal);
			break;
			
		case CutsceneStep.Action.Setup:
			foreach (ActorData data in step.actorData) {
				if (data.actor != null) {
					data.actor.Setup (data.pos, data.rota, data.scale);
				}
			}
			break;
			
		case CutsceneStep.Action.Activate: {
			bool activate = true;
			switch (step.intVal) {
			case 0:
				activate = !step.boolVal2;
				break;
				
			case 1:
				activate = false;
				break;
			}
			
			if (activate) {
				if( step.target == null )
				{
					Debug.LogError("CutsceneStep.Action.Activate Target Null");
				}
				else{
					step.target.gameObject.SetActive(true);
					ActorCam cam = step.target.gameObject.GetComponent<ActorCam>();
					if (cam != null) {
						ActorCam[] objs = FindObjectsOfType(typeof(ActorCam)) as ActorCam[];
						foreach (ActorCam o in objs) {
							if (o != cam)
								o.gameObject.SetActive(false);
						}
					}
				}
			} else
				step.target.gameObject.SetActive(false);
			
			if (step.intVal == 2) {Debug.Log("send message : "+step.strVal+", "+step.strVal2);
				Debug.Log ("step.target "+step.target);
				if(!step.target.gameObject.activeSelf )
					step.target.gameObject.SetActive(true);
				step.target.SendMessage(step.strVal, step.strVal2, SendMessageOptions.DontRequireReceiver);
			}
		}
			break;
			
		case CutsceneStep.Action.Proc:
			if( step.strVal == "BeginLive" )
			{
				GameObject intro = GameObject.Find("IntroSystem");
				if( intro != null )
					intro.SendMessage(step.strVal, step.strVal2);
				else
					SendMessage(step.strVal, step.strVal2);
			}
			else
				SendMessage(step.strVal, step.strVal2);
			break;
			
		case CutsceneStep.Action.PlayMovie:
			/*
			if( step.strVal.Contains("DLA_DummyOpenning" ) )
				DoralabAPI.AddBgmPlayCount(0);

			Handheld.PlayFullScreenMovie(step.strVal, Color.black
				, step.boolVal ? FullScreenMovieControlMode.CancelOnInput : FullScreenMovieControlMode.Hidden);
			*/
			break;
			
		case CutsceneStep.Action.WaitTouch:
			//gbl.StartWaitTouchSound();
			break;
		case CutsceneStep.Action.WaitSound:
			//plugin.StartSoundInputSound();
			//plugin.StartSoundSenser(step.intVal, step.floatVal == 0 ? float.MaxValue : step.floatVal);
			break;
			
		case CutsceneStep.Action.Sound:

			if (step.intVal == 0) {
				if (step.actor == null) {

					if( step.obj != null )
					{
						/*if( step.obj.name.Contains("song_map_short") )
							//DoralabAPI.AddBgmPlayCount(1);
						else if( step.obj.name.Contains("We did it"))
							DoralabAPI.AddBgmPlayCount(2);
						else if( step.obj.name.Contains("we did it"))
							DoralabAPI.AddBgmPlayCount(2);
						else if( step.obj.name.Contains("wedidit"))
							DoralabAPI.AddBgmPlayCount(2);
						else if( step.obj.name.Contains("song_where are we going"))
							DoralabAPI.AddBgmPlayCount(3);
						else if( step.obj.name.Contains("song_backpack"))
							DoralabAPI.AddBgmPlayCount(4);
                        */

						PlayBgm(step.obj as AudioClip, step.boolVal, step.floatVal);
					}
					else{
						StopBgm();
					}
				}
			}
			else if(step.intVal == 2)
			{
				AudioClip bgmclip = bgms[World.langIdx][step.intVal2].clip;
				if(step.intVal2 == 0)
				{
					StopBgm();
				}
				else
				{
					if( bgmclip != null && step.actor == null )
					{
                        /*
						if( bgmclip.name.Contains("song_map_short") )
							DoralabAPI.AddBgmPlayCount(1);
						else if( bgmclip.name.Contains("We did it"))
							DoralabAPI.AddBgmPlayCount(2);
						else if( bgmclip.name.Contains("we did it"))
							DoralabAPI.AddBgmPlayCount(2);
						else if( bgmclip.name.Contains("wedidit"))
							DoralabAPI.AddBgmPlayCount(2);
						else if( bgmclip.name.Contains("song_where are we going"))
							DoralabAPI.AddBgmPlayCount(3);
						else if( bgmclip.name.Contains("song_backpack"))
							DoralabAPI.AddBgmPlayCount(4);
                        */
						PlayBgm(bgmclip, step.boolVal, step.floatVal);
					}
					else if( bgmclip == null )
					{
						StopBgm();
					}
				}
			}
			else {
				Vector3 pos = Vector3.zero;
				if (step.actor != null)
					pos = step.actor.transform.position;
				if( step.obj == null )
				{
					Debug.LogError("Audio Clip is Null");
				}
				else
					AudioSource.PlayClipAtPoint(step.obj as AudioClip, pos, step.floatVal == 0 ? 1 : step.floatVal);
				
				return true;
			}
			break;
			
		case CutsceneStep.Action.ChangeInto:
			switch (step.intVal2) {
			case 0:
				if (step.intVal == 0)
					Global.AddParts(step.actor.name, step.obj as Transform);
				break;
				
			case 1:
				Global.RestoreParts(step.actor);
				return true;

			case 2:
				Global.ClearParts(step.actor);
				return true;
				
			case 3:
				Global.ClearAttach(step.actor, step.obj as Transform);
				return true;
			}
			break;
		}
		
		if (step.actor != null)
			step.actor.DoStep(step);
		
		return true;
	}
Beispiel #4
0
	protected void DrawCutsceneStep()
	{
		//EDIT : San 20140513, edit Layout

		if( SelectedNote != -1 )
		{
			currentStep = SongPlayer.Song.Notes[ SelectedNote ].Step;
		}
		
		CutsceneStep step = currentStep;
		if( step != null)
		{
			
			Color bgrndBak = GUI.backgroundColor;
			//Color colorBak = GUI.color;
			GUI.backgroundColor = LcCutsceneEditor.selectedId == step.stepId ? Color.cyan : bgrndBak;
			
			
			
			//GUI.color = colorBak;
			
			
			//
			//			GUI.color = step.actor != null ? step.actor.symbolColor : colorBak;
			//			if (GUILayout.Button ("", GUILayout.Width(20))) {
			//				SelectStep(step.stepId);
			//			}
			
			//			step.stepId = EditorGUILayout.IntField(step.stepId);
			//			step.preId = EditorGUILayout.IntField("Prev Id:", step.preId);
			//			step.delay = EditorGUILayout.FloatField("Delay:", step.delay);
			
			
			EditorGUILayout.BeginVertical("button");
			{
				
				EditorGUILayout.BeginHorizontal();
				{
					EditorGUILayout.LabelField("Actor: ",GUILayout.Width(50));
					step.actor = (ActorBase) EditorGUILayout.ObjectField(step.actor, typeof(ActorBase), true
					                                                     , GUILayout.Width(150));
					EditorGUILayout.LabelField("WithAction: ",GUILayout.Width(80));
					step.boolVal = EditorGUILayout.Toggle(step.boolVal,GUILayout.Width(50));
				}

				
				if( step.actor != null )
				{
					if( step.actor.objIncludeActor != null )
					{
						step.actor = step.actor.objIncludeActor;
					}
				}
				
				
				tempAcitonDisplay = CutsceneStep.ConverterActionIDToActionDisplayID(step.action);
				EditorGUILayout.LabelField("Action: ",GUILayout.Width(50));
				tempAcitonDisplay = (CutsceneStep.ActionDisplay) EditorGUILayout.EnumPopup(tempAcitonDisplay, GUILayout.Width(100));
				step.action = CutsceneStep.ConverterActionDisplayIDToActionID(tempAcitonDisplay);
				EditorGUILayout.EndHorizontal();

				ActorChar actorChar = null;
				if (step.actor != null){
					actorChar = step.actor.GetComponent<ActorChar>();
				}
				
				
				
				
				switch (step.action) {
				case CutsceneStep.Action.MoveTo:
					EditorGUILayout.BeginHorizontal();
					{

						EditorGUILayout.LabelField("Speed:",GUILayout.Width(50));
						step.floatVal = EditorGUILayout.FloatField(step.floatVal, GUILayout.Width(70));
					

						EditorGUILayout.LabelField("  Pos:",GUILayout.Width(40));
						step.pos = EditorGUILayout.Vector3Field("",step.pos);
						if (GUILayout.Button("Save", GUILayout.Width(80))) {
							step.pos = step.actor.transform.position;
						}
						if (GUILayout.Button("Apply", GUILayout.Width(80))) {
							step.actor.transform.position = step.pos;
						}
					}EditorGUILayout.EndHorizontal();
					
					EditorGUILayout.BeginHorizontal();
					{
						EditorGUILayout.LabelField("MovePosTransform : ",GUILayout.Width(130));
						step.target = (Transform) EditorGUILayout.ObjectField( step.target , typeof(Transform), true);
					

						if( step.target != null )
						{
							step.pos = step.target.position;
							//						step.pos.x = step.target.position. x;
							//						step.pos.x = step.target.position.x;
							//						step.pos.x = step.target.position.x;
						}
						
						
						
						EditorGUILayout.LabelField("Path:", GUILayout.Width(40));
						step.obj = EditorGUILayout.ObjectField( step.obj, typeof(LcPath), true);

						EditorGUILayout.LabelField("EaseType:", GUILayout.Width(60));
						step.easeType = (iTween.EaseType) EditorGUILayout.EnumPopup(step.easeType);
					}EditorGUILayout.EndHorizontal();
					break;
					
				case CutsceneStep.Action.JumpTo:
					EditorGUILayout.BeginHorizontal();
					{
						EditorGUILayout.LabelField("Speed:",GUILayout.Width(50));
						step.floatVal = EditorGUILayout.FloatField(step.floatVal, GUILayout.Width(70));

						EditorGUILayout.LabelField("   Pos:",GUILayout.Width(40));
						step.pos = EditorGUILayout.Vector3Field("",step.pos);
						
						if (GUILayout.Button("Save", GUILayout.Width(80))) {
							step.pos = step.actor.transform.position;
						}
						if (GUILayout.Button("Apply", GUILayout.Width(80))) {
							step.actor.transform.position = step.pos;
						}
					}EditorGUILayout.EndHorizontal();

					break;
					
				case CutsceneStep.Action.GoBack:

					EditorGUILayout.BeginHorizontal();
					{
						EditorGUILayout.LabelField("Speed:",GUILayout.Width(50));
						step.floatVal = EditorGUILayout.FloatField(step.floatVal, GUILayout.Width(70));

					
						EditorGUILayout.LabelField("EaseType:", GUILayout.Width(60));
						step.easeType = (iTween.EaseType) EditorGUILayout.EnumPopup(step.easeType,GUILayout.Width(300));
					}
					EditorGUILayout.EndHorizontal();
					break;
					
				case CutsceneStep.Action.WaitFor:
					EditorGUILayout.BeginHorizontal();
					{
						EditorGUILayout.LabelField("Target:", GUILayout.Width(50)); 
						step.target = (Transform) EditorGUILayout.ObjectField(step.target, typeof(Transform), true);
						if( step.target != null )
						{
							ActorBase temptarget =  step.target.gameObject.GetComponent<ActorBase>();
							if( temptarget != null )
							{
								if( temptarget.objIncludeActor != null )
								{
									step.target = temptarget.objIncludeActor.transform;
								}
							}
						}
						EditorGUILayout.LabelField("Offset:", GUILayout.Width(50)); 
						step.pos = EditorGUILayout.Vector3Field("",step.pos);

						if (GUILayout.Button("Save", GUILayout.Width(80))) {
							step.pos = step.actor.transform.position - step.target.position;
						}
						if (GUILayout.Button("Apply", GUILayout.Width(80))) {
							step.actor.transform.position = step.target.position + step.pos;
						}
					}
					EditorGUILayout.EndHorizontal();

					break;
					
				case CutsceneStep.Action.Follow:
					EditorGUILayout.BeginHorizontal();
					{
						EditorGUILayout.LabelField("Target:", GUILayout.Width(50)); 
						step.target = (Transform) EditorGUILayout.ObjectField(step.target, typeof(Transform), true);
						if( step.target != null )
						{
							ActorBase temptarget =  step.target.gameObject.GetComponent<ActorBase>();
							if( temptarget != null )
							{
								if( temptarget.objIncludeActor != null )
								{
									step.target = temptarget.objIncludeActor.transform;
								}
							}
						}
						EditorGUILayout.LabelField("Offset:", GUILayout.Width(50)); 
						step.pos = EditorGUILayout.Vector3Field("",step.pos);
						
						if (GUILayout.Button("Save", GUILayout.Width(80))) {
							step.pos = step.actor.transform.position - step.target.position;
						}
						if (GUILayout.Button("Apply", GUILayout.Width(80))) {
							step.actor.transform.position = step.target.position + step.pos;
						}
					}
					EditorGUILayout.EndHorizontal();
					EditorGUILayout.BeginHorizontal();
					{
						EditorGUILayout.LabelField("Speed:",GUILayout.Width(50));
						step.floatVal = EditorGUILayout.FloatField(step.floatVal, GUILayout.Width(70));
					}
					EditorGUILayout.EndHorizontal();
					break;
					
				case CutsceneStep.Action.Rotate:
					EditorGUILayout.BeginHorizontal();
					{
						EditorGUILayout.LabelField("Angle:", GUILayout.Width(50)); 
						step.pos = EditorGUILayout.Vector3Field("",step.pos);
						if (GUILayout.Button("Save", GUILayout.Width(80))) {
							step.pos = step.actor.transform.eulerAngles;
						}
						if (GUILayout.Button("Apply", GUILayout.Width(80))) {
							step.actor.transform.eulerAngles = step.pos;
						}
					}
					EditorGUILayout.EndHorizontal();

					break;
				case CutsceneStep.Action.Caption:
					EditorGUILayout.BeginHorizontal();
					{
					if (dialogs != null)

						EditorGUILayout.LabelField("Dialog:", GUILayout.Width(60)); 
						step.intVal = EditorGUILayout.IntPopup(step.intVal, dialogs, dialogIds);
						EditorGUILayout.LabelField("Duration:", GUILayout.Width(60)); 
						step.floatVal = EditorGUILayout.FloatField(step.floatVal,GUILayout.Width(50));
					}
					EditorGUILayout.EndHorizontal();
					break;
				case CutsceneStep.Action.TalkTo:
				case CutsceneStep.Action.SpeechTo:
					if (step.actor != null) {
						ReadActionData(step.actor);
						if (dialogs != null)
							EditorGUILayout.BeginHorizontal();
							{
								if (dialogs != null)
									
								EditorGUILayout.LabelField("Dialog:", GUILayout.Width(50)); 
								step.intVal = EditorGUILayout.IntPopup(step.intVal, dialogs, dialogIds);
								EditorGUILayout.LabelField("Duration:", GUILayout.Width(60)); 
								step.floatVal = EditorGUILayout.FloatField(step.floatVal,GUILayout.Width(50));

						
								EditorGUILayout.LabelField("NextLoopAction:", GUILayout.Width(100)); 
								step.boolVal = EditorGUILayout.Toggle( step.boolVal);	
							}
							EditorGUILayout.EndHorizontal();
							
							EditorGUILayout.BeginHorizontal();
							{
								EditorGUILayout.LabelField("Target:", GUILayout.Width(50)); 
								step.target = (Transform) EditorGUILayout.ObjectField(step.target, typeof(Transform), true);
								
								if( step.target != null )
								{
									ActorBase temptarget =  step.target.gameObject.GetComponent<ActorBase>();
									if( temptarget != null )
									{
										if( temptarget.objIncludeActor != null )
										{
											step.target = temptarget.objIncludeActor.transform;
										}
									}
								}
								if (actorChar != null && actorChar.actionNames != null){
									EditorGUILayout.LabelField("Action:", GUILayout.Width(50));
									step.intVal2 = EditorGUILayout.IntPopup( step.intVal2, actorChar.actionNames, actorChar.actionIds);

								}else{
									EditorGUILayout.LabelField("Action:", GUILayout.Width(50));
									step.intVal2 = EditorGUILayout.IntField( step.intVal2);
								}
									
							}
							EditorGUILayout.EndHorizontal();
					
						

					}
					break;
					
				case CutsceneStep.Action.Action:
					if (step.actor != null) {
						if (actorChar != null)
						{
							ReadActionData(step.actor);
						}
						EditorGUILayout.BeginHorizontal();
						{
							if (actorChar != null && actorChar.actionNames != null)
							{
								EditorGUILayout.LabelField("Action:", GUILayout.Width(50));
								//Debug.Log ("actorChar.actionNames = "+actorChar.actionNames);
								step.intVal = EditorGUILayout.IntPopup( step.intVal, actorChar.actionNames, 
								                                       actorChar.actionIds);
							}else{
								EditorGUILayout.LabelField("Action:", GUILayout.Width(50));
								step.intVal = EditorGUILayout.IntField( step.intVal);
							}

							if (dialogs != null){
								EditorGUILayout.LabelField("Dialog:", GUILayout.Width(50));
								step.intVal2 = EditorGUILayout.IntPopup( step.intVal2, dialogs, dialogIds);
							}
						}
						EditorGUILayout.EndHorizontal();

						EditorGUILayout.BeginHorizontal();
						{
							EditorGUILayout.LabelField("NextLoopAction:", GUILayout.Width(95));
							step.boolVal = EditorGUILayout.Toggle(step.boolVal, GUILayout.Width(50));	
							EditorGUILayout.LabelField("Ignore Blink:", GUILayout.Width(70));
							step.boolVal2 = EditorGUILayout.Toggle( step.boolVal2, GUILayout.Width(10));
						}
						EditorGUILayout.EndHorizontal();
					}
					break;
					
				case CutsceneStep.Action.LoopAction:
					if (step.actor != null) {
						if (actorChar != null)
							ReadLoopActionData(step.actor);
						EditorGUILayout.BeginHorizontal();
						{
							if (actorChar != null && actorChar.loopActionNames != null){
								EditorGUILayout.LabelField("Loop Action:", GUILayout.Width(80));
								step.intVal = EditorGUILayout.IntPopup( step.intVal,actorChar.loopActionNames, actorChar.loopActionIds);
							}else{
								EditorGUILayout.LabelField("Loop Action:", GUILayout.Width(80));
								step.intVal = EditorGUILayout.IntField( step.intVal);
							}


						}
						EditorGUILayout.EndHorizontal();

						EditorGUILayout.BeginHorizontal();
						{
							EditorGUILayout.LabelField("Ignore Blink:", GUILayout.Width(70));
							step.boolVal = EditorGUILayout.Toggle( step.boolVal, GUILayout.Width(10));
						}
						EditorGUILayout.EndHorizontal();
							
					}
					break;
					
				case CutsceneStep.Action.LoadScene:
					EditorGUILayout.BeginHorizontal();
					{
						EditorGUILayout.LabelField("Name:", GUILayout.Width(40));
						step.strVal = EditorGUILayout.TextField( step.strVal);
						EditorGUILayout.LabelField("Effect:", GUILayout.Width(40));
						step.intVal = EditorGUILayout.IntField(step.intVal, GUILayout.Width(200));
						EditorGUILayout.LabelField("Param:", GUILayout.Width(40));
						step.strVal2 = EditorGUILayout.TextField( step.strVal2);
					}
					EditorGUILayout.EndHorizontal();

					EditorGUILayout.BeginHorizontal();
					{
						EditorGUILayout.LabelField("Return Cutscene:", GUILayout.Width(100));
						step.obj = EditorGUILayout.ObjectField(step.obj, typeof(CutsceneMgr), true,GUILayout.Width(200));
					}
					EditorGUILayout.EndHorizontal();
					break;
					
				case CutsceneStep.Action.Setup:
					EditorGUILayout.BeginHorizontal();
					{
						if (GUILayout.Button("Save", GUILayout.Width(80))) {
							if (step.actor == null) {
								UnityEngine.Object[] objs = GameObject.FindObjectsOfType(typeof(ActorBase));
								step.actorData = new ActorData[objs.Length];
								for (int i = 0; i < objs.Length; i++) {
									ActorBase actor = (ActorBase) objs[i];
									ActorData data = new ActorData();
									data.actor = actor;
									data.pos = actor.transform.position;
									data.rota = actor.transform.rotation;
									data.scale = actor.transform.localScale;
									step.actorData[i] = data;
								}
							}  else {
								step.actorData = new ActorData[1];
								ActorBase actor = step.actor;
								ActorData data = new ActorData();
								data.actor = actor;
								data.pos = actor.transform.position;
								data.rota = actor.transform.rotation;
								data.scale = actor.transform.localScale;
								step.actorData[0] = data;
							}
						}
						if (GUILayout.Button("Apply", GUILayout.Width(80))) {
							foreach (ActorData data in step.actorData) {
								if (data.actor != null) {
									data.actor.transform.position = data.pos;
									data.actor.transform.rotation = data.rota;
									data.actor.transform.localScale = data.scale;
								}
							}
						}
					}
					EditorGUILayout.EndHorizontal();
					break;
					
				case CutsceneStep.Action.LookAt:
					step.intVal = EditorGUILayout.IntPopup(step.intVal, lookAtNames, lookAtIds, GUILayout.Width(100));
					switch (step.intVal) {
					case 0:
						EditorGUILayout.BeginHorizontal();
						{
							EditorGUILayout.LabelField("Target:", GUILayout.Width(50));
							step.target = (Transform) EditorGUILayout.ObjectField( step.target, typeof(Transform), true, GUILayout.Width(350));

							
							if( step.target != null )
							{
								ActorBase temptarget =  step.target.gameObject.GetComponent<ActorBase>();
								if( temptarget != null )
								{
									if( temptarget.objIncludeActor != null )
									{
										step.target = temptarget.objIncludeActor.transform;
									}
								}
							}
						}
						EditorGUILayout.EndHorizontal();
						break;
						
					case 1:
						EditorGUILayout.BeginHorizontal();
						{

							EditorGUILayout.LabelField("Target:", GUILayout.Width(50));
							step.target = (Transform) EditorGUILayout.ObjectField(step.target, typeof(Transform), true, GUILayout.Width(350));
						
						
							if( step.target != null )
							{
								ActorBase temptarget =  step.target.gameObject.GetComponent<ActorBase>();
								if( temptarget != null )
								{
									if( temptarget.objIncludeActor != null )
									{
										step.target = temptarget.objIncludeActor.transform;
									}
								}
							}
							EditorGUILayout.LabelField("pos:", GUILayout.Width(50));
							step.pos = EditorGUILayout.Vector3Field("", step.pos, GUILayout.Width(240));
							if (GUILayout.Button("Save", GUILayout.Width(80))) {
								if (step.target != null)
									step.pos = step.target.position;
							}
						}
						EditorGUILayout.EndHorizontal();
						break;
					}
					/*				step.target = (Transform) EditorGUILayout.ObjectField("Target:", step.target, typeof(Transform), true);
			step.pos = EditorGUILayout.Vector3Field("Pos:", step.pos, GUILayout.Width(240));
			if (GUILayout.Button("Current", GUILayout.Width(80))) {
				step.pos = step.target.position;
			}
			step.boolVal = EditorGUILayout.Toggle("Position", step.boolVal);*/
					break;
					
				case CutsceneStep.Action.Activate:
					step.intVal = EditorGUILayout.IntPopup(step.intVal, sendToNames, actionIds, GUILayout.Width(100));
					EditorGUILayout.BeginHorizontal();
					{

						EditorGUILayout.LabelField("Target:", GUILayout.Width(50));
						step.target = (Transform) EditorGUILayout.ObjectField( step.target, typeof(Transform), true);
					}
					EditorGUILayout.EndHorizontal();

					//					if( step.target != null )
					//					{
					//						ActorBase temptarget =  step.target.gameObject.GetComponent<ActorBase>();
					//						if( temptarget != null )
					//						{
					//							if( temptarget.objIncludeActor != null )
					//							{
					//								step.target = temptarget.objIncludeActor.transform;
					//							}
					//						}
					//					}
					switch (step.intVal) {
					case 0:
					case 2:
						EditorGUILayout.BeginHorizontal();
						{
							EditorGUILayout.LabelField("Wait", GUILayout.Width(50));
							step.boolVal = EditorGUILayout.Toggle( step.boolVal);
						}
						EditorGUILayout.EndHorizontal();
						break;
					}
					if (step.intVal == 2) {
						EditorGUILayout.BeginHorizontal();
						{
							EditorGUILayout.LabelField("Method:", GUILayout.Width(50));
							step.strVal = EditorGUILayout.TextField( step.strVal);
						}
						EditorGUILayout.EndHorizontal();

							
						EditorGUILayout.BeginHorizontal();
						{
							EditorGUILayout.LabelField("Param:", GUILayout.Width(50));
							step.strVal2 = EditorGUILayout.TextField( step.strVal2);
						}
						EditorGUILayout.EndHorizontal();
					}
					break;
					
				case CutsceneStep.Action.Proc:
					EditorGUILayout.BeginHorizontal();
					{
						EditorGUILayout.LabelField("Name:", GUILayout.Width(50));
						step.strVal = EditorGUILayout.TextField( step.strVal,GUILayout.Width(150));
						EditorGUILayout.LabelField("Param:", GUILayout.Width(50));
						step.strVal2 = EditorGUILayout.TextField( step.strVal2,GUILayout.Width(300));
						EditorGUILayout.LabelField("Wait", GUILayout.Width(50));
						step.boolVal = EditorGUILayout.Toggle(step.boolVal);
					}
					EditorGUILayout.EndHorizontal();
					break;
					
				case CutsceneStep.Action.Sound:
					//				step.intVal = EditorGUILayout.IntPopup(step.intVal, soundNames, actionIds, GUILayout.Width(80));
					//				step.obj = EditorGUILayout.ObjectField("Clip:", step.obj, typeof(AudioClip), false);
					//				if (step.intVal == 0)
					//					step.boolVal = EditorGUILayout.Toggle("Loop", step.boolVal);
					//				
					//					else if (step.intVal == 1)
					//					{
					//						step.obj = EditorGUILayout.ObjectField("Clip:", step.obj, typeof(AudioClip), false);
					//					}
					//				step.floatVal = EditorGUILayout.FloatField("Volume:", step.floatVal, GUILayout.Width(200));
					
					step.intVal = EditorGUILayout.IntPopup(step.intVal, soundNames, actionIds, GUILayout.Width(80));

					if (step.intVal == 0)
					{
						EditorGUILayout.BeginHorizontal();
						{
							EditorGUILayout.LabelField("Clip:", GUILayout.Width(50));
							step.obj = EditorGUILayout.ObjectField(step.obj, typeof(AudioClip), false);
							EditorGUILayout.LabelField("Loop", GUILayout.Width(50));
							step.boolVal = EditorGUILayout.Toggle( step.boolVal);
						}
						EditorGUILayout.EndHorizontal();
					}
					else if (step.intVal == 1)
					{
						EditorGUILayout.BeginHorizontal();
						{
							EditorGUILayout.LabelField("Clip:", GUILayout.Width(50));
							step.obj = EditorGUILayout.ObjectField(step.obj, typeof(AudioClip), false);
						}
						EditorGUILayout.EndHorizontal();
					}
					else if (step.intVal == 2)
					{
						EditorGUILayout.BeginHorizontal();
						{
							if (bgmNames != null)
								EditorGUILayout.LabelField("Song:", GUILayout.Width(50));
								step.intVal2 = EditorGUILayout.IntPopup( step.intVal2, bgmNames, bgmIds);

							EditorGUILayout.LabelField("Loop", GUILayout.Width(50));
							step.boolVal = EditorGUILayout.Toggle( step.boolVal);
						}
						EditorGUILayout.EndHorizontal();
					}
					EditorGUILayout.BeginHorizontal();
					{
						EditorGUILayout.LabelField("Volume:", GUILayout.Width(50));
						step.floatVal = EditorGUILayout.FloatField(step.floatVal, GUILayout.Width(200));
					}
					EditorGUILayout.EndHorizontal();
					break;

				case CutsceneStep.Action.ChangeInto: 
					step.intVal2 =EditorGUILayout.IntPopup(step.intVal2, changeIntoNames, changeIntoIds, GUILayout.Width(100));

				

					if (step.intVal2 == 0) {
						EditorGUILayout.BeginHorizontal();
						{
							EditorGUILayout.LabelField("Parts:", GUILayout.Width(50));
							step.obj = EditorGUILayout.ObjectField( step.obj, typeof(Transform), false,GUILayout.Width(200));
							EditorGUILayout.LabelField("Prop:", GUILayout.Width(50));
							step.intVal = EditorGUILayout.IntField( step.intVal,GUILayout.Width(50));
						}
						EditorGUILayout.EndHorizontal();
					}
					else if (step.intVal2 == 3) {
						EditorGUILayout.BeginHorizontal();
						{
							EditorGUILayout.LabelField("Parts:", GUILayout.Width(50));
							step.obj = EditorGUILayout.ObjectField(step.obj, typeof(Transform), false);
						}
						EditorGUILayout.EndHorizontal();
					}
					break;
					
				case CutsceneStep.Action.PlayMovie:
					EditorGUILayout.BeginHorizontal();
					{
						EditorGUILayout.LabelField("Movie:", GUILayout.Width(50));
						step.strVal = EditorGUILayout.TextField(step.strVal);
						EditorGUILayout.LabelField("Cancel On Input:", GUILayout.Width(100));
						step.boolVal = EditorGUILayout.Toggle( step.boolVal);
					}
					EditorGUILayout.EndHorizontal();
					break;
					
				case CutsceneStep.Action.UniqueAction:
					EditorGUILayout.BeginHorizontal();
					{
						EditorGUILayout.LabelField("Name:",  GUILayout.Width(50));
						step.strVal = EditorGUILayout.TextField(step.strVal,GUILayout.Width(200));
						EditorGUILayout.LabelField("Phase :", GUILayout.Width(50));
						step.intVal = EditorGUILayout.IntField( step.intVal,GUILayout.Width(50));
					}
					EditorGUILayout.EndHorizontal();
					break;
					
				case CutsceneStep.Action.Mood:
					EditorGUILayout.BeginHorizontal();
					{
						EditorGUILayout.LabelField("Mood:",  GUILayout.Width(50));
						step.intVal = EditorGUILayout.IntPopup( step.intVal, moodNames, moodIds,GUILayout.Width(300));
					}
					EditorGUILayout.EndHorizontal();
					break;
					
				case CutsceneStep.Action.ScaleTo:
					EditorGUILayout.BeginHorizontal();
					{
						EditorGUILayout.LabelField("Speed:",GUILayout.Width(50));
						step.floatVal = EditorGUILayout.FloatField(step.floatVal, GUILayout.Width(70));

						EditorGUILayout.LabelField("  Scale:",GUILayout.Width(40));
						step.pos = EditorGUILayout.Vector3Field("", step.pos);
						
						
						if (GUILayout.Button("Save", GUILayout.Width(80))) {
							step.pos = step.actor.transform.localScale;
						}
						if (GUILayout.Button("Apply", GUILayout.Width(80))) {
							step.actor.transform.localScale = step.pos;
						}
					}
					EditorGUILayout.EndHorizontal();

					EditorGUILayout.BeginHorizontal();
					{
						EditorGUILayout.LabelField("EaseType:", GUILayout.Width(60));
						step.easeType = (iTween.EaseType) EditorGUILayout.EnumPopup(step.easeType, GUILayout.Width(300));
					}
					EditorGUILayout.EndHorizontal();
				
				break;
				case CutsceneStep.Action.WaitTouch:
					step.floatVal = EditorGUILayout.FloatField("Prompt Delay:", step.floatVal, GUILayout.Width(200));
					step.intVal = EditorGUILayout.IntField("Choice:", step.intVal, GUILayout.Width(200));
					
					step.boolVal = EditorGUILayout.Toggle("Send GameLog Touch", step.boolVal,GUILayout.Width (200));
					if( step.boolVal )
					{
						step.intVal2 = EditorGUILayout.IntField("ID:", step.intVal2, GUILayout.Width(200));
					}
					
					
					break;
					
				case CutsceneStep.Action.WaitSound:
					EditorGUILayout.BeginHorizontal();
					{
						 
						EditorGUILayout.LabelField("For:", GUILayout.Width(50));
						step.intVal = EditorGUILayout.IntPopup(step.intVal, 
						                                       new string[] { "(Any)", "Sound", "Blow", "Clap","BlowNoDelay","ClapNoDelay" }, 
						new int[] { 0, 1, 2, 3, 4, 5 } , GUILayout.Width(300));

						EditorGUILayout.LabelField("Timeout:", GUILayout.Width(50));
						step.floatVal = EditorGUILayout.FloatField(step.floatVal, GUILayout.Width(70));


						if( step.boolVal )
						{
							step.intVal2 = EditorGUILayout.IntField("ID:", step.intVal2, GUILayout.Width(200));
						}
					}
					EditorGUILayout.EndHorizontal();

					EditorGUILayout.BeginHorizontal();
					{
						EditorGUILayout.LabelField("Send GameLog Voice", GUILayout.Width(150));
						step.boolVal = EditorGUILayout.Toggle( step.boolVal);
					}
					EditorGUILayout.EndHorizontal();
					break;
					
				case CutsceneStep.Action.GameLog: //GameStart, GameEnd, ChapterStart, ChapterEnd
					step.intVal = EditorGUILayout.IntPopup(step.intVal, gameLogNames, gameLogIds, GUILayout.Width(100));
					if( step.intVal < 2 ) //GameStart, GameEnd
					{
						EditorGUILayout.BeginHorizontal();
						{
							EditorGUILayout.LabelField("ID:", GUILayout.Width(50));
							step.intVal2 = EditorGUILayout.IntField( step.intVal2, GUILayout.Width(200));
						}
						EditorGUILayout.EndHorizontal();
					}
					break;
				}
				
				/*				
			step.floatVal = EditorGUILayout.FloatField("Value:", step.floatVal);
			step.target = EditorGUILayout.ObjectField("Target:", step.target, typeof(UnityEngine.Object), true);
							 */
				EditorGUILayout.BeginHorizontal();
				{
					EditorGUILayout.LabelField("Comment: ", GUILayout.Width(60));
					step.note = EditorGUILayout.TextField(step.note);
				}EditorGUILayout.EndHorizontal();

				GUILayout.Space(1);
			}
			EditorGUILayout.EndVertical();
		}

	}
	public bool DoStep(CutsceneStep step) {
//		if (step.action == CutsceneStep.Action.WaitTouch && step.intVal > 0) {
//			if (IsBool(step.intVal, step.actor.name)) {
//				step.actor.WaitTouch(0, false);
//				return false;
//			}
//		}
		
		switch (step.action) {			
		case CutsceneStep.Action.GameLog://GameStart, GameEnd, ChapterStart, ChapterEnd
			if( step.intVal == 0 )//GameStart
			{
				World.SendGameLog("G",step.intVal2,true );//type, id, bSuccess
			}
			else if( step.intVal == 1 )//GameEnd
			{
				World.SendGameLog("G",step.intVal2,false );//type, id, bSuccess
			}
			else if( step.intVal == 2 )//ChapterStart
			{
				World.EpisodeChapterState( true );
			}
			else if( step.intVal == 3 )//ChapterEnd
			{
				World.EpisodeChapterState( false );
			}
			break;
		case CutsceneStep.Action.Caption:
			if( World.langCaptionIdx != -1 )
			{
				if (step.intVal > 0 && dialogs[World.langCaptionIdx].Length > step.intVal) {
					gbl.DisplaySubtitle(dialogs[World.langCaptionIdx][step.intVal].caption, step.actor);
				}
			}

			break;
		case CutsceneStep.Action.TalkTo:
		case CutsceneStep.Action.SpeechTo:
			if (step.intVal2 > 0)
				step.actor.Action(step.intVal2, false, null);
			
			if( World.langCaptionIdx != -1 )
			{
				if (step.intVal > 0 && dialogs[World.langIdx].Length > step.intVal) {
					gbl.DisplaySubtitle(dialogs[World.langCaptionIdx][step.intVal].caption, step.actor);
					if (step.floatVal == 0)
						step.actor.TalkTo(dialogs[World.langIdx][step.intVal].clip, step.target, step.action);
				}
			}
			else
			{
				if (step.intVal > 0) {
					if (step.floatVal == 0)
						step.actor.TalkTo(dialogs[World.langIdx][step.intVal].clip, step.target, step.action);
				}
			}
			if (step.floatVal > 0) {
				step.actor.LipTo(step.floatVal, step.target, step.action);
			}
			step.actor.NextLoopAction(step.boolVal);
			break;
			
		case CutsceneStep.Action.Action:
			AudioClip clip = null;
			if (step.intVal2 > 0 && dialogs[World.langIdx].Length > step.intVal2)
				clip = dialogs[World.langIdx][step.intVal2].clip;
			step.actor.Action(step.intVal, false,  clip);
			step.actor.NextLoopAction(step.boolVal);
			break;
			
		case CutsceneStep.Action.LoadScene:
			//World.loadedLevelName = step.strVal;
			if( World.loadedLevelName == "")
				World.loadedLevelName = Application.loadedLevelName;
			
			Debug.Log("LoadScene Pre loadedName = "+World.loadedLevelName);
			
			if( World.loadedLevelName.Contains("_ending") )
				World.EpisodeFinish();
			
			//English Episode Ending Check
			if( step.strVal.Contains("GoToStart") )
			{
				if( World.loadedLevelName.Contains("episode_e") )
					World.EpisodeFinish();
			}

			Global.SetScene(step.obj as CutsceneMgr); Debug.Log("step.obj = "+step.obj);
			World.sceneParam = step.strVal2;Debug.Log("step.strval2 : "+step.strVal2);
			Global.LoadScene(step.strVal, step.intVal);Debug.Log("step.strval : "+step.strVal+", step.intval : "+step.intVal);
			break;
			
		case CutsceneStep.Action.Setup:
			foreach (ActorData data in step.actorData) {
				if (data.actor != null) {
					data.actor.Setup (data.pos, data.rota, data.scale);
				}
			}
			break;
			
		case CutsceneStep.Action.Activate: {
			bool activate = true;
			switch (step.intVal) {
			case 0:
				activate = !step.boolVal2;
				break;
				
			case 1:
				activate = false;
				break;
			}
			
			if (activate) {
				if( step.target == null )
				{
					Debug.LogError("CutsceneStep.Action.Activate Target Null");
				}
				else{
					step.target.gameObject.SetActive(true);
					ActorCam cam = step.target.gameObject.GetComponent<ActorCam>();
					if (cam != null) {
						ActorCam[] objs = FindObjectsOfType(typeof(ActorCam)) as ActorCam[];
						foreach (ActorCam o in objs) {
							if (o != cam)
								o.gameObject.SetActive(false);
						}
					}
				}
			} else
				step.target.gameObject.SetActive(false);
			
			if (step.intVal == 2) {Debug.Log("send message : "+step.strVal+", "+step.strVal2);
				step.target.SendMessage(step.strVal, step.strVal2, SendMessageOptions.DontRequireReceiver);
			}
		}
			break;
			
		case CutsceneStep.Action.Proc:
			SendMessage(step.strVal, step.strVal2);
			break;
			
		case CutsceneStep.Action.PlayMovie:
			Handheld.PlayFullScreenMovie(step.strVal, Color.black
				, step.boolVal ? FullScreenMovieControlMode.CancelOnInput : FullScreenMovieControlMode.Hidden);
			break;
			
		case CutsceneStep.Action.WaitTouch:
			gbl.StartWaitTouchSound();
			break;
		case CutsceneStep.Action.WaitSound:
			//plugin.StartSoundInputSound();
			plugin.StartSoundSenser(step.intVal, step.floatVal == 0 ? float.MaxValue : step.floatVal);
			break;
			
		case CutsceneStep.Action.Sound:
			if (step.intVal == 0) {
				if (step.actor == null) {
					PlayBgm(step.obj as AudioClip, step.boolVal, step.floatVal);
				}
			}
			else if(step.intVal == 2)
			{
				AudioClip bgmclip = bgms[World.langIdx][step.intVal2].clip;
				if( bgmclip != null && step.actor == null )
					PlayBgm(bgmclip, step.boolVal, step.floatVal);
			}
			else {
				Vector3 pos = Vector3.zero;
				if (step.actor != null)
					pos = step.actor.transform.position;
				if( step.obj == null )
				{
					Debug.LogError("Audio Clip is Null");
				}
				else
					AudioSource.PlayClipAtPoint(step.obj as AudioClip, pos, step.floatVal == 0 ? 1 : step.floatVal);
				
				return true;
			}
			break;
			
		case CutsceneStep.Action.ChangeInto:
			switch (step.intVal2) {
			case 0:
				if (step.intVal == 0)
					Global.AddParts(step.actor.name, step.obj as Transform);
				break;
				
			case 1:
				Global.RestoreParts(step.actor);
				return true;

			case 2:
				Global.ClearParts(step.actor);
				return true;
			}
			break;
		}
		
		if (step.actor != null)
			step.actor.DoStep(step);
		
		return true;
	}
Beispiel #6
0
	public virtual void MoveTo(Vector3 pos, float speed, CutsceneStep step) {
		StopMoveTo ();
//		Stop();
		
		if( step != null )
			bMoveWithAction = step.boolVal ;
		
		posBak = transform.position;
		posToGo = pos;
		
		moveSpeed = speed;
//		jumping = false;
//		moving = true;
//		Debug.Log("========= position : "+posToGo);
		iTween.EaseType easeType = iTween.EaseType.linear;
//			Hashtable hash = iTween.Hash("from", transform.position, "to", posToGo, "speed", speed, "oncomplete"
//			, "OnITweenComplete", "oncompleteparams", CutsceneStep.Action.MoveTo, "onupdate", "OnITweenUpdate");
		Hashtable hash = iTween.Hash("position", posToGo, "speed", speed);
		
		if (step != null) {
			easeType = step.easeType;
			
			if (step.obj != null) {
				LcPath path1 = step.obj as LcPath;
				if (path1.loop) {
					Transform[] forms = path1.forms;
					
					Vector3[] path = new Vector3[forms.Length + 1];
					int i;
					for (i = 0; i < forms.Length; i++) {
						path[i] = forms[i].position;
					}
					path[i] = forms[0].position;
					
					hash.Add("path", path);
					
					hash.Add("movetopath", false);
					hash.Add ("looptype", iTween.LoopType.loop);
				} else 
					hash.Add("path", path1.forms);
			}
		}
		
		hash.Add("easetype", easeType);
		
		if (moveDummy == null)
			moveDummy = (new GameObject("_Dummy")).transform;
		moveDummy.position = transform.position;
		iTween.MoveTo (moveDummy.gameObject, hash);
		
	}
Beispiel #7
0
	public virtual void LipTo(float duration, Transform form, CutsceneStep.Action action) {
		formToTalkTo = GetHeadForm(form);
		if( audioSrc != null )
			audioSrc.Stop ();
		else
			return;
		
		if (duration > 0) {
			lastAudioVerb = action;
			lipDuration = duration;
		}
	}
Beispiel #8
0
	public virtual void TalkTo(AudioClip clip, Transform form, CutsceneStep.Action action) {
		formToTalkTo = GetHeadForm(form);
		Sound(clip, action, false, 1);
	}
Beispiel #9
0
	public void Sound(AudioClip clip, CutsceneStep.Action action, bool loop, float volume) {
		if( audioSrc != null )
			audioSrc.Stop ();
		else
			return;
		
		if (clip != null) {
			lastAudioVerb = action;
			
			audioSrc.clip = clip;
			audioSrc.loop = loop;
			if (volume == 0)
				volume = 1;
			audioSrc.volume = volume;
			audioSrc.Play();
		}
	}
Beispiel #10
0
	public void DoStep(CutsceneStep step) {
		switch (step.action) {
		case CutsceneStep.Action.MoveTo:
			MoveTo(step.pos, step.floatVal == 0 ? 1f : step.floatVal, step);
			break;

		case CutsceneStep.Action.GoBack:
			MoveTo(posBak, step.floatVal == 0 ? 1f : step.floatVal, step);
			break;
			
		case CutsceneStep.Action.JumpTo:
			JumpTo(step.pos, step.floatVal == 0 ? 1f : step.floatVal);
			break;
			
		case CutsceneStep.Action.Follow:
			Follow(step.target, step.pos, step.boolVal, step.floatVal);
			break;
			
		case CutsceneStep.Action.Rotate:
			Rotate(step.pos);
			break;
			
		case CutsceneStep.Action.WaitFor:
			WaitFor(step.target.transform, step.pos);
			break;
			
		case CutsceneStep.Action.WaitTouch:
			WaitTouch(step.floatVal, true);
			break;
			
		case CutsceneStep.Action.LookAt:
			LookAt(step.target, step.pos, step.intVal);
			break;
			
		case CutsceneStep.Action.Stop:
			Stop();
			break;
			
		case CutsceneStep.Action.Action:
			if (step.intVal2 > 0)
				lastAudioVerb = step.action;	
			break;
			
		case CutsceneStep.Action.Sound:
			Sound (step.obj as AudioClip, step.action, step.boolVal, step.floatVal);
			break;
		
		case CutsceneStep.Action.ChangeInto:
			if( step.intVal2 != 1 )// Not Restore
				ChangeInto(step.obj as Transform, step.intVal);
			break;
			
		case CutsceneStep.Action.UniqueAction:
			UniqueAction(step.strVal, step.intVal);
			break;
			
		case CutsceneStep.Action.LoopAction:
			LoopAction(step.intVal, step.boolVal);
			break;
			
		case CutsceneStep.Action.Mood:
			Mood(step.intVal);
			break;
			
		case CutsceneStep.Action.ScaleTo:
			ScaleTo (step.pos, step.floatVal == 0 ? 1f : step.floatVal, step);
			break;
		}
		
	}
Beispiel #11
0
	public virtual bool IsDone(CutsceneStep.Action action) {
		switch (action) {
		case CutsceneStep.Action.MoveTo:
		case CutsceneStep.Action.JumpTo:
		case CutsceneStep.Action.Rotate:
		case CutsceneStep.Action.GoBack:
			return !isMoving;
			
		case CutsceneStep.Action.TalkTo:
		case CutsceneStep.Action.SpeechTo:
			return !isTalking;
		case CutsceneStep.Action.Action:
			
			//ONEWAY Check
#if TestTalk
			if( audioSrc.clip != null )
			{
				return !isTalking;
			}
#endif
			return isIdle;
		case CutsceneStep.Action.WaitTouch:
			return isIdle;

		case CutsceneStep.Action.WaitFor:
		case CutsceneStep.Action.Follow:
			return !isFollowing;
			
		case CutsceneStep.Action.Sound:
			return !isSounding;
			
		case CutsceneStep.Action.ScaleTo:
			return iTween.Count (gameObject, "scale") == 0;
		}
		
		return true;
	}
Beispiel #12
0
	public virtual void ScaleTo(Vector3 scale, float speed, CutsceneStep step) {
		StopScaleTo();
		
		iTween.EaseType easeType = iTween.EaseType.linear;
		if (step != null) {
			easeType = step.easeType;
		}
		iTween.ScaleTo (gameObject, iTween.Hash("scale", scale, "speed", speed, "easetype", easeType));
	}
Beispiel #13
0
	void RemoveStep(CutsceneStep step) {
		mgr.steps.Remove(step);
	}
Beispiel #14
0
	void AddStep(CutsceneStep before) {
		if (mgr.steps == null)
			mgr.steps = new List<CutsceneStep>();
		
		CutsceneStep newStep = new CutsceneStep();

		if (before == null) {
			newStep.stepId = stepIdGap;
			mgr.steps.Add (newStep);
			return;
		}
		
		if (Selection.activeTransform != null) {
			newStep.actor = before.actor;
		}

		int nextId = int.MaxValue;
		foreach (CutsceneStep step in mgr.steps) {
			if (step.stepId > before.stepId) {
				nextId = Math.Min (nextId, step.stepId);
			}
		}
		
		newStep.stepId = before.stepId + stepIdGap;
		if (nextId != int.MaxValue) {
			newStep.stepId = Math.Min(before.stepId + (nextId - before.stepId) / 2, newStep.stepId);
		}
		
		newStep.preId = before.stepId;
		
		for (int i = 0; i < mgr.steps.Count; i++) {
			if (mgr.steps[i] == before) {
				mgr.steps.Insert(i + 1, newStep);
				
				break;
			}
		}
		
		SelectStep(newStep.stepId);
	}
Beispiel #15
0
	void DoStep(CutsceneStep step) {
		switch (step.action) {
		case CutsceneStep.Action.MoveTo:
		case CutsceneStep.Action.JumpTo:
			if (step.obj) {
				step.actor.transform.position = ((LcPath) step.obj).forms[0].position;
			} else
				step.actor.transform.position = step.pos;
			if (followSteps.ContainsKey(step.actor))
				followSteps.Remove(step.actor);
			break;
			
		case CutsceneStep.Action.Follow:
			if (followSteps.ContainsKey(step.actor))
				followSteps.Remove(step.actor);
			break;
			
		case CutsceneStep.Action.Rotate:
			step.actor.transform.eulerAngles = step.pos;
			break;
			
		case CutsceneStep.Action.TalkTo:
			break;
			
		case CutsceneStep.Action.WaitFor:
			break;
		
		case CutsceneStep.Action.Action:
			break;
			
		case CutsceneStep.Action.WaitTouch:
			break;
			
		case CutsceneStep.Action.LoadScene:
			break;
			
		case CutsceneStep.Action.Setup:
			foreach (ActorData data in step.actorData) {
				if (data.actor != null) {
					data.actor.transform.position = data.pos;
					data.actor.transform.rotation = data.rota;
					data.actor.transform.localScale = data.scale;
				}
			}
			break;
		}
	}
Beispiel #16
0
	void OnGUI () {
		if (mgr == null) {
			EditorGUILayout.LabelField("Select Cutscene Object");
			return;
		}
		
		if (mgr.steps == null || mgr.steps.Count == 0) {
			return;
		}
		
		_zoomArea = new Rect(0.0f, 35.0f, position.width , position.height - 35.0f-150.0f);
		
		HandleEvents();
		EditorZoomArea.Begin(_zoom, _zoomArea);	
        GUILayout.BeginArea(new Rect(0.0f - _zoomCoordsOrigin.x , 35.0f - _zoomCoordsOrigin.y, 120.0f+mgr.steps.Count*120.0f , position.height-35.0f));
		
//		steps = mgr.steps;
//		currStep = null;
		List<CutsceneStep> steps = mgr.steps;
		
		List<ActorSteps> actorList = new List<ActorSteps>();
		List<CutsceneStep> currSteps = new List<CutsceneStep>();
		List<CutsceneStep> nextSteps = new List<CutsceneStep>();
		CutsceneStep currStep = null;
		
		int iLvl = 0;
		int iMaxLvl = 0;
		while (steps != null) {
			foreach (CutsceneStep step in steps) {
				
				List<CutsceneStep> list = null;
				foreach (ActorSteps actorSteps in actorList) {
					if (actorSteps.actor == step.actor) {
						list = actorSteps.steps;
						break;
					}
				}
				if (list == null) {
					ActorSteps actorSteps = new ActorSteps(step.actor);
					actorList.Add (actorSteps);
					list = actorSteps.steps;
				}
				
				if (!list.Contains(step)) {
					if (step.preId != step.stepId) {
						if ((currStep == null && step.preId == 0) || (currStep != null && currStep.stepId > 0 && step.preId == currStep.stepId)) {
							step.prevStep = currStep;
							while (list.Count < iLvl)
								list.Add(null);
							list.Add (step);
							iMaxLvl = Math.Max (iMaxLvl, list.Count);
							nextSteps.Add (step);
						}
					}
				}
			}

			if (currSteps.Count == 0) {
				if (nextSteps.Count == 0)
					break;
				
				currSteps = nextSteps;
				nextSteps = new List<CutsceneStep>();
				iLvl = iMaxLvl;
			}
			
			currStep = currSteps[0];
			currSteps.RemoveAt(0);
		}
/*
		if (GUILayout.Button("Add New Step", GUILayout.Width(120))) {
			AddStep(null);
		}
				 */
		EditorGUILayout.Space();
		
		//scroll1 = EditorGUILayout.BeginScrollView(scroll1);
		
		foreach (ActorSteps actorSteps in actorList) {
			EditorGUILayout.BeginHorizontal("Box");
			
			Color colorBak = GUI.color;
			GUI.color = actorSteps.actor == null ? colorBak : actorSteps.actor.symbolColor;
			GUILayout.Label (actorSteps.actor == null ? "None" : actorSteps.actor.name, GUILayout.Width(100));
			GUI.color = colorBak;
			
			foreach (CutsceneStep step in actorSteps.steps) {
				if (step == null) {
					GUILayout.Label ("", GUILayout.Width(120));
				} else {
					
#if UNITY_EDITOR
					if( step.bCurrentStep )
						GUI.backgroundColor = Color.red;
#endif
//					if (selectedStep == step)
					if (LcCutsceneEditor.selectedId == step.stepId)
						GUI.backgroundColor = Color.cyan;
					EditorGUILayout.BeginHorizontal("Box", GUILayout.Width(120));
					
					if (step.prevStep != null) {
						GUI.color = step.prevStep.actor == null ? colorBak : step.prevStep.actor.symbolColor;
						GUILayout.Label (step.prevStep.actor == null ? "N" : step.prevStep.actor.name.Substring(0, 1), GUILayout.Width(20));
						GUI.color = colorBak;
					} else {
						GUILayout.Label ("", GUILayout.Width(20));
					}
					
					if (GUILayout.Button (step.action.ToString(), GUILayout.Width(80))) {
						SelectStep(step.stepId);
						currentStep = step;
						dialogs = LcCutsceneEditor.dialogs;
						dialogIds = LcCutsceneEditor.dialogIds;
						bgmNames = LcCutsceneEditor.bgmNames;
						bgmIds = LcCutsceneEditor.bgmIds;
					}
					EditorGUILayout.EndHorizontal();
					
					GUI.backgroundColor = colorBak;
				}
			}
			
			EditorGUILayout.EndHorizontal();
			
//			EditorGUILayout.Space();
		}

		//EditorGUILayout.EndScrollView();
		
        GUILayout.EndArea();
        EditorZoomArea.End();
		
		DrawNonZoomArea();
	}