public static void PropertiesGUI(Cutscene _target) { EditorGUILayout.BeginVertical ("Button"); EditorGUILayout.LabelField ("Cutscene properties", EditorStyles.boldLabel); _target.source = (ActionListSource) EditorGUILayout.EnumPopup ("Actions source:", _target.source); if (_target.source == ActionListSource.AssetFile) { _target.assetFile = (ActionListAsset) EditorGUILayout.ObjectField ("ActionList asset:", _target.assetFile, typeof (ActionListAsset), false); } _target.actionListType = (ActionListType) EditorGUILayout.EnumPopup ("When running:", _target.actionListType); if (_target.actionListType == ActionListType.PauseGameplay) { _target.isSkippable = EditorGUILayout.Toggle ("Is skippable?", _target.isSkippable); } _target.triggerTime = EditorGUILayout.Slider ("Start delay (s):", _target.triggerTime, 0f, 10f); _target.autosaveAfter = EditorGUILayout.Toggle ("Auto-save after?", _target.autosaveAfter); if (_target.source == ActionListSource.InScene) { _target.useParameters = EditorGUILayout.Toggle ("Use parameters?", _target.useParameters); } EditorGUILayout.EndVertical (); if (_target.useParameters) { EditorGUILayout.Space (); EditorGUILayout.BeginVertical ("Button"); EditorGUILayout.LabelField ("Parameters", EditorStyles.boldLabel); ActionListEditor.ShowParametersGUI (_target.parameters); EditorGUILayout.EndVertical (); } }
override public void AssignValues (List<ActionParameter> parameters) { SceneSettings sceneSettings = GameObject.FindWithTag (Tags.gameEngine).GetComponent <SceneSettings>(); if (sceneSetting == SceneSetting.DefaultNavMesh) { if (sceneSettings.navigationMethod == AC_NavigationMethod.PolygonCollider && changeNavMeshMethod == ChangeNavMeshMethod.ChangeNumberOfHoles) { hole = AssignFile <PolygonCollider2D> (parameters, parameterID, constantID, hole); } else { newNavMesh = AssignFile <NavigationMesh> (parameters, parameterID, constantID, newNavMesh); } } else if (sceneSetting == SceneSetting.DefaultPlayerStart) { playerStart = AssignFile <PlayerStart> (parameters, parameterID, constantID, playerStart); } else if (sceneSetting == SceneSetting.SortingMap) { sortingMap = AssignFile <SortingMap> (parameters, parameterID, constantID, sortingMap); } else if (sceneSetting == SceneSetting.OnLoadCutscene || sceneSetting == SceneSetting.OnStartCutscene) { cutscene = AssignFile <Cutscene> (parameters, parameterID, constantID, cutscene); } }
/** * <summary>A Constructor that copies the values of another ActionEnd.</summary> * <param name = "_actionEnd">The ActionEnd to copy from</param> */ public ActionEnd(ActionEnd _actionEnd) { resultAction = _actionEnd.resultAction; skipAction = _actionEnd.skipAction; skipActionActual = _actionEnd.skipActionActual; linkedCutscene = _actionEnd.linkedCutscene; linkedAsset = _actionEnd.linkedAsset; }
/** * A Constructor that sets skipAction explicitly. */ public ActionEnd(int _skipAction) { resultAction = ResultAction.Continue; skipAction = _skipAction; skipActionActual = null; linkedCutscene = null; linkedAsset = null; }
public static Cutscene CutsceneGUI(string label, Cutscene cutscene) { EditorGUILayout.BeginHorizontal (); cutscene = (Cutscene) EditorGUILayout.ObjectField (label, cutscene, typeof (Cutscene), true); if (cutscene == null) { if (GUILayout.Button ("Create", GUILayout.MaxWidth (60f))) { cutscene = SceneManager.AddPrefab ("Logic", "Cutscene", true, false, true).GetComponent <Cutscene>(); cutscene.Initialise (); } } EditorGUILayout.EndHorizontal (); return cutscene; }
protected void AfterRunningOption() { EditorGUILayout.Space(); endAction = (ResultAction)EditorGUILayout.EnumPopup("After running:", (ResultAction)endAction); if (endAction == ResultAction.RunCutscene) { if (isAssetFile) { linkedAsset = ActionListAssetMenu.AssetGUI("ActionList to run:", linkedAsset); } else { linkedCutscene = ActionListAssetMenu.CutsceneGUI("Cutscene to run:", linkedCutscene); } } }
override public void SkipActionGUI(List <Action> actions, bool showGUI) { if (showGUI) { EditorGUILayout.Space(); resultActionTrue = (ResultAction)EditorGUILayout.EnumPopup("If condition is met:", (ResultAction)resultActionTrue); } if (resultActionTrue == ResultAction.RunCutscene && showGUI) { if (isAssetFile) { linkedAssetTrue = ActionListAssetMenu.AssetGUI("ActionList to run:", linkedAssetTrue); } else { linkedCutsceneTrue = ActionListAssetMenu.CutsceneGUI("Cutscene to run:", linkedCutsceneTrue); } } else if (resultActionTrue == ResultAction.Skip) { SkipActionTrueGUI(actions, showGUI); } if (showGUI) { resultActionFail = (ResultAction)EditorGUILayout.EnumPopup("If condition is not met:", (ResultAction)resultActionFail); } if (resultActionFail == ResultAction.RunCutscene && showGUI) { if (isAssetFile) { linkedAssetFail = ActionListAssetMenu.AssetGUI("ActionList to run:", linkedAssetFail); } else { linkedCutsceneFail = ActionListAssetMenu.CutsceneGUI("Cutscene to run:", linkedCutsceneFail); } } else if (resultActionFail == ResultAction.Skip) { SkipActionFailGUI(actions, showGUI); } }
public override void AssignValues(List <ActionParameter> parameters) { if (sceneSettings == null) { return; } switch (sceneSetting) { case SceneSetting.DefaultNavMesh: if (KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.PolygonCollider && changeNavMeshMethod == ChangeNavMeshMethod.ChangeNumberOfHoles) { runtimeHole = AssignFile <PolygonCollider2D> (parameters, parameterID, constantID, hole); runtimeReplaceHole = AssignFile <PolygonCollider2D> (parameters, replaceParameterID, replaceConstantID, replaceHole); runtimeNewNavMesh = null; } else { runtimeHole = null; runtimeReplaceHole = null; runtimeNewNavMesh = AssignFile <NavigationMesh> (parameters, parameterID, constantID, newNavMesh); } break; case SceneSetting.DefaultPlayerStart: runtimePlayerStart = AssignFile <PlayerStart> (parameters, parameterID, constantID, playerStart); break; case SceneSetting.SortingMap: runtimeSortingMap = AssignFile <SortingMap> (parameters, parameterID, constantID, sortingMap); break; case SceneSetting.TintMap: runtimeTintMap = AssignFile <TintMap> (parameters, parameterID, constantID, tintMap); break; case SceneSetting.OnLoadCutscene: case SceneSetting.OnStartCutscene: runtimeCutscene = AssignFile <Cutscene> (parameters, parameterID, constantID, cutscene); break; } }
public static Cutscene CutsceneGUI(string label, Cutscene cutscene, string defaultName = "", string api = "", string tooltip = "") { EditorGUILayout.BeginHorizontal(); cutscene = (Cutscene)CustomGUILayout.ObjectField <Cutscene> (label, cutscene, true, api, tooltip); if (cutscene == null) { if (GUILayout.Button("Create", GUILayout.MaxWidth(60f))) { cutscene = SceneManager.AddPrefab("Logic", "Cutscene", true, false, true).GetComponent <Cutscene>(); cutscene.Initialise(); if (!string.IsNullOrEmpty(defaultName)) { cutscene.gameObject.name = AdvGame.UniqueName(defaultName); } } } EditorGUILayout.EndHorizontal(); return(cutscene); }
override public void AssignValues(List <ActionParameter> parameters) { if (sceneSettings == null) { return; } if (sceneSetting == SceneSetting.DefaultNavMesh) { if (KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.PolygonCollider && changeNavMeshMethod == ChangeNavMeshMethod.ChangeNumberOfHoles) { hole = AssignFile <PolygonCollider2D> (parameters, parameterID, constantID, hole); replaceHole = AssignFile <PolygonCollider2D> (parameters, replaceParameterID, replaceConstantID, replaceHole); } else { newNavMesh = AssignFile <NavigationMesh> (parameters, parameterID, constantID, newNavMesh); } } else if (sceneSetting == SceneSetting.DefaultPlayerStart) { playerStart = AssignFile <PlayerStart> (parameters, parameterID, constantID, playerStart); } else if (sceneSetting == SceneSetting.SortingMap) { sortingMap = AssignFile <SortingMap> (parameters, parameterID, constantID, sortingMap); } else if (sceneSetting == SceneSetting.TintMap) { tintMap = AssignFile <TintMap> (parameters, parameterID, constantID, tintMap); } else if (sceneSetting == SceneSetting.OnLoadCutscene || sceneSetting == SceneSetting.OnStartCutscene) { cutscene = AssignFile <Cutscene> (parameters, parameterID, constantID, cutscene); } }
/** * The default Constructor. */ public NodeCommand() { cutscene = null; actionListAsset = null; parameterID = -1; }
public override void SkipActionGUI(List<Action> actions, bool showGUI) { if (showGUI) { EditorGUILayout.Space (); resultActionTrue = (ResultAction) EditorGUILayout.EnumPopup("If condition is met:", (ResultAction) resultActionTrue); } if (resultActionTrue == ResultAction.RunCutscene && showGUI) { if (isAssetFile) { linkedAssetTrue = ActionListAssetMenu.AssetGUI ("ActionList to run:", linkedAssetTrue); } else { linkedCutsceneTrue = ActionListAssetMenu.CutsceneGUI ("Cutscene to run:", linkedCutsceneTrue); } } else if (resultActionTrue == ResultAction.Skip) { SkipActionTrueGUI (actions, showGUI); } if (showGUI) { resultActionFail = (ResultAction) EditorGUILayout.EnumPopup("If condition is not met:", (ResultAction) resultActionFail); } if (resultActionFail == ResultAction.RunCutscene && showGUI) { if (isAssetFile) { linkedAssetFail = ActionListAssetMenu.AssetGUI ("ActionList to run:", linkedAssetFail); } else { linkedCutsceneFail = ActionListAssetMenu.CutsceneGUI ("Cutscene to run:", linkedCutsceneFail); } } else if (resultActionFail == ResultAction.Skip) { SkipActionFailGUI (actions, showGUI); } }
override public void SkipActionGUI (List<Action> actions, bool showGUI) { if (showGUI) { EditorGUILayout.Space (); resultActionTrue = (ResultAction) EditorGUILayout.EnumPopup("If condition is met:", (ResultAction) resultActionTrue); } if (resultActionTrue == ResultAction.RunCutscene && showGUI) { if (isAssetFile) { linkedAssetTrue = (ActionListAsset) EditorGUILayout.ObjectField ("ActionList to run:", linkedAssetTrue, typeof (ActionListAsset), false); } else { linkedCutsceneTrue = (Cutscene) EditorGUILayout.ObjectField ("Cutscene to run:", linkedCutsceneTrue, typeof (Cutscene), true); } } else if (resultActionTrue == ResultAction.Skip) { SkipActionTrueGUI (actions, showGUI); } if (showGUI) { resultActionFail = (ResultAction) EditorGUILayout.EnumPopup("If condition is not met:", (ResultAction) resultActionFail); } if (resultActionFail == ResultAction.RunCutscene && showGUI) { if (isAssetFile) { linkedAssetFail = (ActionListAsset) EditorGUILayout.ObjectField ("ActionList to run:", linkedAssetFail, typeof (ActionListAsset), false); } else { linkedCutsceneFail = (Cutscene) EditorGUILayout.ObjectField ("Cutscene to run:", linkedCutsceneFail, typeof (Cutscene), true); } } else if (resultActionFail == ResultAction.Skip) { SkipActionFailGUI (actions, showGUI); } }
public static Action RebuildAction(AC.Action action, int typeIndex, ActionListAsset _target, ResultAction _resultAction, int _skipAction, ActionListAsset _linkedAsset, Cutscene _linkedCutscene) { ActionsManager actionsManager = AdvGame.GetReferences ().actionsManager; if (actionsManager) { ActionListAssetEditor.DeleteAction (action, _target); string className = actionsManager.AllActions [typeIndex].fileName; AC.Action newAction = (AC.Action) CreateInstance (className); newAction.hideFlags = HideFlags.HideInHierarchy; newAction.endAction = _resultAction; newAction.skipAction = _skipAction; newAction.linkedAsset = _linkedAsset; newAction.linkedCutscene = _linkedCutscene; AssetDatabase.AddObjectToAsset (newAction, _target); AssetDatabase.ImportAsset (AssetDatabase.GetAssetPath (newAction)); AssetDatabase.SaveAssets (); AssetDatabase.Refresh (); return newAction; } return action; }
public static AC.Action RebuildAction(AC.Action action, int typeIndex, ResultAction _resultAction, int _skipAction, ActionListAsset _linkedAsset, Cutscene _linkedCutscene) { ActionsManager actionsManager = AdvGame.GetReferences().actionsManager; if (actionsManager) { string className = actionsManager.AllActions [typeIndex].fileName; if (action.GetType().ToString() != className && action.GetType().ToString() != ("AC." + className)) { bool _showComment = action.showComment; bool _showOutputSockets = action.showOutputSockets; string _comment = action.comment; action = (AC.Action)CreateInstance(className); action.endAction = _resultAction; action.skipAction = _skipAction; action.linkedAsset = _linkedAsset; action.linkedCutscene = _linkedCutscene; action.showComment = _showComment; action.showOutputSockets = _showOutputSockets; action.comment = _comment; } } return(action); }
public void ShowGUI() { GUILayout.Label("Basic structure", EditorStyles.boldLabel); if (GUILayout.Button("Organise room objects")) { InitialiseObjects(); } if (AdvGame.GetReferences().settingsManager == null) { EditorGUILayout.HelpBox("No Settings Manager defined - cannot display full Editor without it!", MessageType.Warning); return; } if (KickStarter.sceneSettings == null) { return; } SettingsManager settingsManager = AdvGame.GetReferences().settingsManager; EditorGUILayout.BeginHorizontal(); newFolderName = EditorGUILayout.TextField(newFolderName); if (GUILayout.Button("Create new folder", buttonWidth)) { if (newFolderName != "") { GameObject newFolder = new GameObject(); if (!newFolderName.StartsWith("_")) { newFolder.name = "_" + newFolderName; } else { newFolder.name = newFolderName; } Undo.RegisterCreatedObjectUndo(newFolder, "Create folder " + newFolder.name); if (Selection.activeGameObject) { newFolder.transform.parent = Selection.activeGameObject.transform; } Selection.activeObject = newFolder; } } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); GUILayout.Label("Scene settings", EditorStyles.boldLabel); KickStarter.sceneSettings.navigationMethod = (AC_NavigationMethod)EditorGUILayout.EnumPopup("Pathfinding method:", KickStarter.sceneSettings.navigationMethod); KickStarter.navigationManager.ResetEngine(); if (KickStarter.navigationManager.navigationEngine != null) { KickStarter.navigationManager.navigationEngine.SceneSettingsGUI(); } if (settingsManager.IsUnity2D() && KickStarter.sceneSettings.navigationMethod != AC_NavigationMethod.PolygonCollider) { EditorGUILayout.HelpBox("This pathfinding method is not compatible with 'Unity 2D'.", MessageType.Warning); } EditorGUILayout.BeginHorizontal(); KickStarter.sceneSettings.defaultPlayerStart = (PlayerStart)EditorGUILayout.ObjectField("Default PlayerStart:", KickStarter.sceneSettings.defaultPlayerStart, typeof(PlayerStart), true); if (KickStarter.sceneSettings.defaultPlayerStart == null) { if (GUILayout.Button("Create", GUILayout.MaxWidth(60f))) { PlayerStart newPlayerStart = AddPrefab("Navigation", "PlayerStart", true, false, true).GetComponent <PlayerStart>(); newPlayerStart.gameObject.name = "Default PlayerStart"; KickStarter.sceneSettings.defaultPlayerStart = newPlayerStart; } } EditorGUILayout.EndHorizontal(); if (KickStarter.sceneSettings.defaultPlayerStart) { EditorGUILayout.BeginHorizontal(); KickStarter.sceneSettings.defaultPlayerStart.cameraOnStart = (_Camera)EditorGUILayout.ObjectField("Default Camera:", KickStarter.sceneSettings.defaultPlayerStart.cameraOnStart, typeof(_Camera), true); if (KickStarter.sceneSettings.defaultPlayerStart.cameraOnStart == null) { if (GUILayout.Button("Create", GUILayout.MaxWidth(60f))) { if (settingsManager == null || settingsManager.cameraPerspective == CameraPerspective.ThreeD) { GameCamera newCamera = AddPrefab("Camera", "GameCamera", true, false, true).GetComponent <GameCamera>(); newCamera.gameObject.name = "NavCam 1"; KickStarter.sceneSettings.defaultPlayerStart.cameraOnStart = newCamera; } else if (settingsManager.cameraPerspective == CameraPerspective.TwoD) { GameCamera2D newCamera = AddPrefab("Camera", "GameCamera2D", true, false, true).GetComponent <GameCamera2D>(); newCamera.gameObject.name = "NavCam 1"; KickStarter.sceneSettings.defaultPlayerStart.cameraOnStart = newCamera; } else if (settingsManager.cameraPerspective == CameraPerspective.TwoPointFiveD) { GameCamera25D newCamera = AddPrefab("Camera", "GameCamera2.5D", true, false, true).GetComponent <GameCamera25D>(); newCamera.gameObject.name = "NavCam 1"; KickStarter.sceneSettings.defaultPlayerStart.cameraOnStart = newCamera; } } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.BeginHorizontal(); KickStarter.sceneSettings.sortingMap = (SortingMap)EditorGUILayout.ObjectField("Default Sorting map:", KickStarter.sceneSettings.sortingMap, typeof(SortingMap), true); if (KickStarter.sceneSettings.sortingMap == null) { if (GUILayout.Button("Create", GUILayout.MaxWidth(60f))) { SortingMap newSortingMap = AddPrefab("Navigation", "SortingMap", true, false, true).GetComponent <SortingMap>(); newSortingMap.gameObject.name = "Default SortingMap"; KickStarter.sceneSettings.sortingMap = newSortingMap; } } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); KickStarter.sceneSettings.defaultSound = (Sound)EditorGUILayout.ObjectField("Default Sound prefab:", KickStarter.sceneSettings.defaultSound, typeof(Sound), true); if (KickStarter.sceneSettings.defaultSound == null) { if (GUILayout.Button("Create", GUILayout.MaxWidth(60f))) { Sound newSound = AddPrefab("Logic", "Sound", true, false, true).GetComponent <Sound>(); newSound.gameObject.name = "Default Sound"; KickStarter.sceneSettings.defaultSound = newSound; newSound.playWhilePaused = true; } } EditorGUILayout.EndHorizontal(); GUILayout.Label("Scene cutscenes", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); KickStarter.sceneSettings.cutsceneOnStart = (Cutscene)EditorGUILayout.ObjectField("On start:", KickStarter.sceneSettings.cutsceneOnStart, typeof(Cutscene), true); if (KickStarter.sceneSettings.cutsceneOnStart == null) { if (GUILayout.Button("Create", GUILayout.MaxWidth(60f))) { Cutscene newCutscene = AddPrefab("Logic", "Cutscene", true, false, true).GetComponent <Cutscene>(); newCutscene.gameObject.name = "OnStart"; KickStarter.sceneSettings.cutsceneOnStart = newCutscene; } } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); KickStarter.sceneSettings.cutsceneOnLoad = (Cutscene)EditorGUILayout.ObjectField("On load:", KickStarter.sceneSettings.cutsceneOnLoad, typeof(Cutscene), true); if (KickStarter.sceneSettings.cutsceneOnLoad == null) { if (GUILayout.Button("Create", GUILayout.MaxWidth(60f))) { Cutscene newCutscene = AddPrefab("Logic", "Cutscene", true, false, true).GetComponent <Cutscene>(); newCutscene.gameObject.name = "OnLoad"; KickStarter.sceneSettings.cutsceneOnLoad = newCutscene; } } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); KickStarter.sceneSettings.cutsceneOnVarChange = (Cutscene)EditorGUILayout.ObjectField("On variable change:", KickStarter.sceneSettings.cutsceneOnVarChange, typeof(Cutscene), true); if (KickStarter.sceneSettings.cutsceneOnVarChange == null) { if (GUILayout.Button("Create", GUILayout.MaxWidth(60f))) { Cutscene newCutscene = AddPrefab("Logic", "Cutscene", true, false, true).GetComponent <Cutscene>(); newCutscene.gameObject.name = "OnVarChange"; KickStarter.sceneSettings.cutsceneOnVarChange = newCutscene; } } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); GUILayout.Label("Visibility", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); GUILayout.Label("Triggers", buttonWidth); if (GUILayout.Button("On", EditorStyles.miniButtonLeft)) { SetTriggerVisibility(true); } if (GUILayout.Button("Off", EditorStyles.miniButtonRight)) { SetTriggerVisibility(false); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Collision", buttonWidth); if (GUILayout.Button("On", EditorStyles.miniButtonLeft)) { SetCollisionVisiblity(true); } if (GUILayout.Button("Off", EditorStyles.miniButtonRight)) { SetCollisionVisiblity(false); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Hotspots", buttonWidth); if (GUILayout.Button("On", EditorStyles.miniButtonLeft)) { SetHotspotVisibility(true); } if (GUILayout.Button("Off", EditorStyles.miniButtonRight)) { SetHotspotVisibility(false); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("NavMesh", buttonWidth); if (GUILayout.Button("On", EditorStyles.miniButtonLeft)) { KickStarter.navigationManager.navigationEngine.SetVisibility(true); } if (GUILayout.Button("Off", EditorStyles.miniButtonRight)) { KickStarter.navigationManager.navigationEngine.SetVisibility(false); } GUILayout.EndHorizontal(); ListPrefabs(); if (GUI.changed) { EditorUtility.SetDirty(KickStarter.sceneSettings); EditorUtility.SetDirty(KickStarter.playerMovement); if (KickStarter.sceneSettings.defaultPlayerStart) { EditorUtility.SetDirty(KickStarter.sceneSettings.defaultPlayerStart); } } }
public static Action RebuildAction(AC.Action action, int typeIndex, ActionListAsset _target, ResultAction _resultAction, int _skipAction, ActionListAsset _linkedAsset, Cutscene _linkedCutscene) { ActionsManager actionsManager = AdvGame.GetReferences().actionsManager; if (actionsManager) { ActionListAssetEditor.DeleteAction(action, _target); string className = actionsManager.AllActions [typeIndex].fileName; AC.Action newAction = (AC.Action)CreateInstance(className); newAction.hideFlags = HideFlags.HideInHierarchy; newAction.endAction = _resultAction; newAction.skipAction = _skipAction; newAction.linkedAsset = _linkedAsset; newAction.linkedCutscene = _linkedCutscene; AssetDatabase.AddObjectToAsset(newAction, _target); AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(newAction)); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); return(newAction); } return(action); }
override public void ShowGUI(List <ActionParameter> parameters) { if (KickStarter.sceneSettings == null) { return; } sceneSetting = (SceneSetting)EditorGUILayout.EnumPopup("Scene setting to change:", sceneSetting); if (sceneSetting == SceneSetting.DefaultNavMesh) { if (KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.meshCollider || KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.PolygonCollider) { if (KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.PolygonCollider) { changeNavMeshMethod = (ChangeNavMeshMethod)EditorGUILayout.EnumPopup("Change NavMesh method:", changeNavMeshMethod); } if (KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.meshCollider || changeNavMeshMethod == ChangeNavMeshMethod.ChangeNavMesh) { parameterID = Action.ChooseParameterGUI("New NavMesh:", parameters, parameterID, ParameterType.GameObject); if (parameterID >= 0) { constantID = 0; newNavMesh = null; } else { newNavMesh = (NavigationMesh)EditorGUILayout.ObjectField("New NavMesh:", newNavMesh, typeof(NavigationMesh), true); constantID = FieldToID <NavigationMesh> (newNavMesh, constantID); newNavMesh = IDToField <NavigationMesh> (newNavMesh, constantID, false); } } else if (changeNavMeshMethod == ChangeNavMeshMethod.ChangeNumberOfHoles) { holeAction = (InvAction)EditorGUILayout.EnumPopup("Add or remove hole:", holeAction); string _label = "Hole to add:"; if (holeAction == InvAction.Remove) { _label = "Hole to remove:"; } parameterID = Action.ChooseParameterGUI(_label, parameters, parameterID, ParameterType.GameObject); if (parameterID >= 0) { constantID = 0; hole = null; } else { hole = (PolygonCollider2D)EditorGUILayout.ObjectField(_label, hole, typeof(PolygonCollider2D), true); constantID = FieldToID <PolygonCollider2D> (hole, constantID); hole = IDToField <PolygonCollider2D> (hole, constantID, false); } if (holeAction == InvAction.Replace) { replaceParameterID = Action.ChooseParameterGUI("Hole to remove:", parameters, replaceParameterID, ParameterType.GameObject); if (replaceParameterID >= 0) { replaceConstantID = 0; replaceHole = null; } else { replaceHole = (PolygonCollider2D)EditorGUILayout.ObjectField("Hole to remove:", replaceHole, typeof(PolygonCollider2D), true); replaceConstantID = FieldToID <PolygonCollider2D> (replaceHole, replaceConstantID); replaceHole = IDToField <PolygonCollider2D> (replaceHole, replaceConstantID, false); } } } } else { EditorGUILayout.HelpBox("This action is not compatible with the Unity Navigation pathfinding method, as set in the Scene Manager.", MessageType.Warning); } } else if (sceneSetting == SceneSetting.DefaultPlayerStart) { parameterID = Action.ChooseParameterGUI("New default PlayerStart:", parameters, parameterID, ParameterType.GameObject); if (parameterID >= 0) { constantID = 0; playerStart = null; } else { playerStart = (PlayerStart)EditorGUILayout.ObjectField("New default PlayerStart:", playerStart, typeof(PlayerStart), true); constantID = FieldToID <PlayerStart> (playerStart, constantID); playerStart = IDToField <PlayerStart> (playerStart, constantID, false); } } else if (sceneSetting == SceneSetting.SortingMap) { parameterID = Action.ChooseParameterGUI("New SortingMap:", parameters, parameterID, ParameterType.GameObject); if (parameterID >= 0) { constantID = 0; sortingMap = null; } else { sortingMap = (SortingMap)EditorGUILayout.ObjectField("New SortingMap:", sortingMap, typeof(SortingMap), true); constantID = FieldToID <SortingMap> (sortingMap, constantID); sortingMap = IDToField <SortingMap> (sortingMap, constantID, false); } } else if (sceneSetting == SceneSetting.TintMap) { parameterID = Action.ChooseParameterGUI("New TintMap:", parameters, parameterID, ParameterType.GameObject); if (parameterID >= 0) { constantID = 0; tintMap = null; } else { tintMap = (TintMap)EditorGUILayout.ObjectField("New TintMap:", tintMap, typeof(TintMap), true); constantID = FieldToID <TintMap> (tintMap, constantID); tintMap = IDToField <TintMap> (tintMap, constantID, false); } } else if (sceneSetting == SceneSetting.OnLoadCutscene) { parameterID = Action.ChooseParameterGUI("New OnLoad cutscene:", parameters, parameterID, ParameterType.GameObject); if (parameterID >= 0) { constantID = 0; cutscene = null; } else { cutscene = (Cutscene)EditorGUILayout.ObjectField("New OnLoad custscne:", cutscene, typeof(Cutscene), true); constantID = FieldToID <Cutscene> (cutscene, constantID); cutscene = IDToField <Cutscene> (cutscene, constantID, false); } } else if (sceneSetting == SceneSetting.OnStartCutscene) { parameterID = Action.ChooseParameterGUI("New OnStart cutscene:", parameters, parameterID, ParameterType.GameObject); if (parameterID >= 0) { constantID = 0; cutscene = null; } else { cutscene = (Cutscene)EditorGUILayout.ObjectField("New OnStart cutscene:", cutscene, typeof(Cutscene), true); constantID = FieldToID <Cutscene> (cutscene, constantID); cutscene = IDToField <Cutscene> (cutscene, constantID, false); } } AfterRunningOption(); }
public override void ShowGUI(List<ActionParameter> parameters) { if (KickStarter.sceneSettings == null) { return; } sceneSetting = (SceneSetting) EditorGUILayout.EnumPopup ("Scene setting to change:", sceneSetting); if (sceneSetting == SceneSetting.DefaultNavMesh) { if (KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.meshCollider || KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.PolygonCollider) { if (KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.PolygonCollider) { changeNavMeshMethod = (ChangeNavMeshMethod) EditorGUILayout.EnumPopup ("Change NavMesh method:", changeNavMeshMethod); } if (KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.meshCollider || changeNavMeshMethod == ChangeNavMeshMethod.ChangeNavMesh) { parameterID = Action.ChooseParameterGUI ("New NavMesh:", parameters, parameterID, ParameterType.GameObject); if (parameterID >= 0) { constantID = 0; newNavMesh = null; } else { newNavMesh = (NavigationMesh) EditorGUILayout.ObjectField ("New NavMesh:", newNavMesh, typeof (NavigationMesh), true); constantID = FieldToID <NavigationMesh> (newNavMesh, constantID); newNavMesh = IDToField <NavigationMesh> (newNavMesh, constantID, false); } } else if (changeNavMeshMethod == ChangeNavMeshMethod.ChangeNumberOfHoles) { holeAction = (InvAction) EditorGUILayout.EnumPopup ("Add or remove hole:", holeAction); string _label = "Hole to add:"; if (holeAction == InvAction.Remove) { _label = "Hole to remove:"; } parameterID = Action.ChooseParameterGUI (_label, parameters, parameterID, ParameterType.GameObject); if (parameterID >= 0) { constantID = 0; hole = null; } else { hole = (PolygonCollider2D) EditorGUILayout.ObjectField (_label, hole, typeof (PolygonCollider2D), true); constantID = FieldToID <PolygonCollider2D> (hole, constantID); hole = IDToField <PolygonCollider2D> (hole, constantID, false); } if (holeAction == InvAction.Replace) { replaceParameterID = Action.ChooseParameterGUI ("Hole to remove:", parameters, replaceParameterID, ParameterType.GameObject); if (replaceParameterID >= 0) { replaceConstantID = 0; replaceHole = null; } else { replaceHole = (PolygonCollider2D) EditorGUILayout.ObjectField ("Hole to remove:", replaceHole, typeof (PolygonCollider2D), true); replaceConstantID = FieldToID <PolygonCollider2D> (replaceHole, replaceConstantID); replaceHole = IDToField <PolygonCollider2D> (replaceHole, replaceConstantID, false); } } } } else { EditorGUILayout.HelpBox ("This action is not compatible with the Unity Navigation pathfinding method, as set in the Scene Manager.", MessageType.Warning); } } else if (sceneSetting == SceneSetting.DefaultPlayerStart) { parameterID = Action.ChooseParameterGUI ("New default PlayerStart:", parameters, parameterID, ParameterType.GameObject); if (parameterID >= 0) { constantID = 0; playerStart = null; } else { playerStart = (PlayerStart) EditorGUILayout.ObjectField ("New default PlayerStart:", playerStart, typeof (PlayerStart), true); constantID = FieldToID <PlayerStart> (playerStart, constantID); playerStart = IDToField <PlayerStart> (playerStart, constantID, false); } } else if (sceneSetting == SceneSetting.SortingMap) { parameterID = Action.ChooseParameterGUI ("New SortingMap:", parameters, parameterID, ParameterType.GameObject); if (parameterID >= 0) { constantID = 0; sortingMap = null; } else { sortingMap = (SortingMap) EditorGUILayout.ObjectField ("New SortingMap:", sortingMap, typeof (SortingMap), true); constantID = FieldToID <SortingMap> (sortingMap, constantID); sortingMap = IDToField <SortingMap> (sortingMap, constantID, false); } } else if (sceneSetting == SceneSetting.TintMap) { parameterID = Action.ChooseParameterGUI ("New TintMap:", parameters, parameterID, ParameterType.GameObject); if (parameterID >= 0) { constantID = 0; tintMap = null; } else { tintMap = (TintMap) EditorGUILayout.ObjectField ("New TintMap:", tintMap, typeof (TintMap), true); constantID = FieldToID <TintMap> (tintMap, constantID); tintMap = IDToField <TintMap> (tintMap, constantID, false); } } else if (sceneSetting == SceneSetting.OnLoadCutscene) { parameterID = Action.ChooseParameterGUI ("New OnLoad cutscene:", parameters, parameterID, ParameterType.GameObject); if (parameterID >= 0) { constantID = 0; cutscene = null; } else { cutscene = (Cutscene) EditorGUILayout.ObjectField ("New OnLoad custscne:", cutscene, typeof (Cutscene), true); constantID = FieldToID <Cutscene> (cutscene, constantID); cutscene = IDToField <Cutscene> (cutscene, constantID, false); } } else if (sceneSetting == SceneSetting.OnStartCutscene) { parameterID = Action.ChooseParameterGUI ("New OnStart cutscene:", parameters, parameterID, ParameterType.GameObject); if (parameterID >= 0) { constantID = 0; cutscene = null; } else { cutscene = (Cutscene) EditorGUILayout.ObjectField ("New OnStart cutscene:", cutscene, typeof (Cutscene), true); constantID = FieldToID <Cutscene> (cutscene, constantID); cutscene = IDToField <Cutscene> (cutscene, constantID, false); } } AfterRunningOption (); }
public override void AssignValues(List<ActionParameter> parameters) { if (sceneSetting == SceneSetting.DefaultNavMesh) { if (KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.PolygonCollider && changeNavMeshMethod == ChangeNavMeshMethod.ChangeNumberOfHoles) { hole = AssignFile <PolygonCollider2D> (parameters, parameterID, constantID, hole); replaceHole = AssignFile <PolygonCollider2D> (parameters, replaceParameterID, replaceConstantID, replaceHole); } else { newNavMesh = AssignFile <NavigationMesh> (parameters, parameterID, constantID, newNavMesh); } } else if (sceneSetting == SceneSetting.DefaultPlayerStart) { playerStart = AssignFile <PlayerStart> (parameters, parameterID, constantID, playerStart); } else if (sceneSetting == SceneSetting.SortingMap) { sortingMap = AssignFile <SortingMap> (parameters, parameterID, constantID, sortingMap); } else if (sceneSetting == SceneSetting.SortingMap) { tintMap = AssignFile <TintMap> (parameters, parameterID, constantID, tintMap); } else if (sceneSetting == SceneSetting.OnLoadCutscene || sceneSetting == SceneSetting.OnStartCutscene) { cutscene = AssignFile <Cutscene> (parameters, parameterID, constantID, cutscene); } }
public static AC.Action RebuildAction(AC.Action action, int typeIndex, ResultAction _resultAction, int _skipAction, ActionListAsset _linkedAsset, Cutscene _linkedCutscene) { ActionsManager actionsManager = AdvGame.GetReferences ().actionsManager; if (actionsManager) { string className = actionsManager.AllActions [typeIndex].fileName; if (action.GetType ().ToString () != className && action.GetType ().ToString () != ("AC." + className)) { action = (AC.Action) CreateInstance (className); action.endAction = _resultAction; action.skipAction = _skipAction; action.linkedAsset = _linkedAsset; action.linkedCutscene = _linkedCutscene; } } return action; }
private IEnumerator DelayPathCutscene(float pauseTime, Cutscene pauseCutscene) { yield return new WaitForSeconds (pauseTime); pausePathTime = 0f; pauseCutscene.Interact (); nodeActionList = pauseCutscene; }
private void PausePath(float pauseTime, Cutscene pauseCutscene, int parameterID) { charState = CharState.Decelerate; pausePath = true; if (pauseCutscene.useParameters && parameterID >= 0 && pauseCutscene.parameters.Count > parameterID) { pauseCutscene.parameters [parameterID].SetValue (this.gameObject); } if (pauseTime > 0f) { pausePathTime = Time.time + pauseTime + 1f; StartCoroutine (DelayPathCutscene (pauseTime, pauseCutscene)); } else { pausePathTime = 0f; pauseCutscene.Interact (); nodeActionList = pauseCutscene; } }
protected ActionEnd GenerateActionEnd(ResultAction _resultAction, ActionListAsset _linkedAsset, Cutscene _linkedCutscene, int _skipAction, Action _skipActionActual, List <Action> _actions) { ActionEnd actionEnd = new ActionEnd(); actionEnd.resultAction = _resultAction; actionEnd.linkedAsset = _linkedAsset; actionEnd.linkedCutscene = _linkedCutscene; if (_resultAction == ResultAction.RunCutscene) { if (isAssetFile && _linkedAsset != null) { actionEnd.linkedAsset = _linkedAsset; } else if (!isAssetFile && _linkedCutscene != null) { actionEnd.linkedCutscene = _linkedCutscene; } } else if (_resultAction == ResultAction.Skip) { int skip = _skipAction; if (_skipActionActual && _actions.Contains(_skipActionActual)) { skip = _actions.IndexOf(_skipActionActual); } else if (skip == -1) { skip = 0; } actionEnd.skipAction = skip; } return(actionEnd); }
private void PausePath(Cutscene pauseCutscene, int parameterID) { charState = CharState.Decelerate; pausePath = true; pausePathTime = 0f; if (pauseCutscene.useParameters && parameterID >= 0 && pauseCutscene.parameters.Count > parameterID) { pauseCutscene.parameters [parameterID].SetValue (this.gameObject); } pauseCutscene.Interact (); nodeActionList = pauseCutscene; }