public override void AssignValues(List<ActionParameter> parameters) { if (isPlayer) { if (KickStarter.player && KickStarter.player.spriteChild != null && KickStarter.player.spriteChild.GetComponent <FollowTintMap>()) { followTintMap = KickStarter.player.spriteChild.GetComponent <FollowTintMap>(); } else { ACDebug.LogWarning ("Could not find a FollowTintMap component on the Player - be sure to place one on the sprite child."); } } else { followTintMap = AssignFile <FollowTintMap> (parameters, followTintMapParameterID, followTintMapConstantID, followTintMap); } if (tintMapMethod == TintMapMethod.ChangeTintMap && !followDefault) { newTintMap = AssignFile <TintMap> (parameters, newTintMapParameterID, newTintMapConstantID, newTintMap); } if (timeToChange < 0f) { timeToChange = 0f; } }
/** * <summary>Updates it's own variables from a VisibilityData class.</summary> * <param name = "data">The VisibilityData class to load from</param> */ public void LoadData(VisibilityData data) { useDefaultTintMap = data.useDefaultTintMap; SetIntensity (data.tintIntensity, 0f); if (!useDefaultTintMap && data.tintMapID != 0) { tintMap = Serializer.returnComponent <TintMap> (data.tintMapID); } ResetTintMap (); }
/** * Assigns the internal TintMap to follow based on the chosen public variables. */ public void ResetTintMap() { actualTintMap = tintMap; if (useDefaultTintMap && KickStarter.sceneSettings) { if (KickStarter.sceneSettings.tintMap) { actualTintMap = KickStarter.sceneSettings.tintMap; } else { Debug.Log (this.gameObject.name + " cannot find Tint Map to follow!"); } } }
override public 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; } }
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); } }
public override void AssignValues(List <ActionParameter> parameters) { if (isPlayer) { if (KickStarter.player && KickStarter.player.spriteChild != null && KickStarter.player.spriteChild.GetComponent <FollowTintMap>()) { runtimeFollowTintMap = KickStarter.player.spriteChild.GetComponent <FollowTintMap>(); } } else { runtimeFollowTintMap = AssignFile <FollowTintMap> (parameters, followTintMapParameterID, followTintMapConstantID, followTintMap); } if (tintMapMethod == TintMapMethod.ChangeTintMap && !followDefault) { runtimeNewTintMap = AssignFile <TintMap> (parameters, newTintMapParameterID, newTintMapConstantID, newTintMap); } if (timeToChange < 0f) { timeToChange = 0f; } }
public override void ShowGUI(List<ActionParameter> parameters) { tintMapMethod = (TintMapMethod) EditorGUILayout.EnumPopup ("Change to make:", tintMapMethod); isPlayer = EditorGUILayout.Toggle ("Affect Player?", isPlayer); if (!isPlayer) { followTintMapParameterID = Action.ChooseParameterGUI ("FollowTintMap:", parameters, followTintMapParameterID, ParameterType.GameObject); if (followTintMapParameterID >= 0) { followTintMapConstantID = 0; followTintMap = null; } else { followTintMap = (FollowTintMap) EditorGUILayout.ObjectField ("FollowTintMap:", followTintMap, typeof (FollowTintMap), true); followTintMapConstantID = FieldToID <FollowTintMap> (followTintMap, followTintMapConstantID); followTintMap = IDToField <FollowTintMap> (followTintMap, followTintMapConstantID, false); } } if (tintMapMethod == TintMapMethod.ChangeTintMap) { followDefault = EditorGUILayout.Toggle ("Use scene's default TintMap?", followDefault); if (!followDefault) { newTintMapParameterID = Action.ChooseParameterGUI ("New TintMap:", parameters, newTintMapParameterID, ParameterType.GameObject); if (newTintMapParameterID >= 0) { newTintMapConstantID = 0; followTintMap = null; } else { newTintMap = (TintMap) EditorGUILayout.ObjectField ("New TintMap:", newTintMap, typeof (TintMap), true); newTintMapConstantID = FieldToID <TintMap> (newTintMap, newTintMapConstantID); newTintMap = IDToField <TintMap> (newTintMap, newTintMapConstantID, false); } } } else if (tintMapMethod == TintMapMethod.ChangeIntensity) { newIntensity = EditorGUILayout.Slider ("New intensity:", newIntensity, 0f, 1f); isInstant = EditorGUILayout.Toggle ("Change instantly?", isInstant); if (!isInstant) { timeToChange = EditorGUILayout.FloatField ("Time to change (s):", timeToChange); if (timeToChange > 0f) { willWait = EditorGUILayout.Toggle ("Wait until finish?", willWait); } } } AfterRunningOption (); }
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 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 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 (); }
/** * <summary>Creates a new instance of the 'Object: Change Tint map' Action, set to change the active TintMap</summary> * <param name = "followTintMap">The FollowTintMap to update</param> * <param name = "newTintMap">The new TintMap to assign to the FollowTintMap</param> * <returns>The generated Action</returns> */ public static ActionTintMap CreateNew_ChangeTintMap(FollowTintMap followTintMap, TintMap newTintMap) { ActionTintMap newAction = (ActionTintMap)CreateInstance <ActionTintMap>(); newAction.tintMapMethod = TintMapMethod.ChangeTintMap; newAction.followTintMap = followTintMap; newAction.newTintMap = newTintMap; return(newAction); }
public override void ShowGUI(List <ActionParameter> parameters) { tintMapMethod = (TintMapMethod)EditorGUILayout.EnumPopup("Change to make:", tintMapMethod); isPlayer = EditorGUILayout.Toggle("Affect Player?", isPlayer); if (isPlayer) { playerParameterID = ChooseParameterGUI("Player ID:", parameters, playerParameterID, ParameterType.Integer); if (playerParameterID < 0) { playerID = ChoosePlayerGUI(playerID, true); } } else { followTintMapParameterID = Action.ChooseParameterGUI("FollowTintMap:", parameters, followTintMapParameterID, ParameterType.GameObject); if (followTintMapParameterID >= 0) { followTintMapConstantID = 0; followTintMap = null; } else { followTintMap = (FollowTintMap)EditorGUILayout.ObjectField("FollowTintMap:", followTintMap, typeof(FollowTintMap), true); followTintMapConstantID = FieldToID <FollowTintMap> (followTintMap, followTintMapConstantID); followTintMap = IDToField <FollowTintMap> (followTintMap, followTintMapConstantID, false); } } if (tintMapMethod == TintMapMethod.ChangeTintMap) { followDefault = EditorGUILayout.Toggle("Follow scene default?", followDefault); if (!followDefault) { newTintMapParameterID = Action.ChooseParameterGUI("New TintMap:", parameters, newTintMapParameterID, ParameterType.GameObject); if (newTintMapParameterID >= 0) { newTintMapConstantID = 0; followTintMap = null; } else { newTintMap = (TintMap)EditorGUILayout.ObjectField("New TintMap:", newTintMap, typeof(TintMap), true); newTintMapConstantID = FieldToID <TintMap> (newTintMap, newTintMapConstantID); newTintMap = IDToField <TintMap> (newTintMap, newTintMapConstantID, false); } } } else if (tintMapMethod == TintMapMethod.ChangeIntensity) { newIntensity = EditorGUILayout.Slider("New intensity:", newIntensity, 0f, 1f); isInstant = EditorGUILayout.Toggle("Change instantly?", isInstant); if (!isInstant) { timeToChange = EditorGUILayout.FloatField("Time to change (s):", timeToChange); if (timeToChange > 0f) { willWait = EditorGUILayout.Toggle("Wait until finish?", willWait); } } } AfterRunningOption(); }