void Start() { _gameEnded = false; TimeRemaining = LevelTime; // Using float cast to prevent loss of decimal accuracy. Slider.value = LevelTime / (float)LevelTime; am = GameObject.Find("GameManager").GetComponent<ActionsManager>(); gm = GameObject.Find("GameManager").GetComponent<GameManager>(); }
private void OnEnable () { if (AdvGame.GetReferences () && AdvGame.GetReferences ().actionsManager) { actionsManager = AdvGame.GetReferences ().actionsManager; } if (_targetAsset != null) { UnmarkAll (true); } else { UnmarkAll (false); } }
public override void OnInspectorGUI() { InvActionList _target = (InvActionList)target; actionsManager = AdvGame.GetReferences().actionsManager; for (int i = 0; i < _target.actions.Count; i++) { EditorGUILayout.BeginVertical("Button"); string actionLabel = " " + (i).ToString() + ": " + _target.actions[i].title + _target.actions[i].SetLabel(); _target.actions[i].isDisplayed = EditorGUILayout.Foldout(_target.actions[i].isDisplayed, actionLabel); if (_target.actions[i].isDisplayed) { EditorGUILayout.Space(); ShowActionGUI(_target.actions[i], i, _target.actions.Count); EditorGUILayout.BeginHorizontal(); if (i > 0) { if (GUILayout.Button("Move up")) { _target.actions = AdvGame.SwapActions(_target.actions, i, i - 1); } } if (GUILayout.Button("Delete")) { DeleteAction(_target.actions[i]); } if (i < _target.actions.Count - 1) { if (GUILayout.Button("Move down")) { _target.actions = AdvGame.SwapActions(_target.actions, i, i + 1); } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Type:", labelWidth); if (typeNumber == -1) { typeNumber = actionsManager.defaultClass; } typeNumber = EditorGUILayout.Popup(typeNumber, actionsManager.GetActionTitles()); if (GUILayout.Button("Add new")) { AddAction(actionsManager.GetActionName(typeNumber)); } EditorGUILayout.EndHorizontal(); if (GUI.changed) { EditorUtility.SetDirty(_target); } }
public override void UseIt() // cuando aprieto atacar: { ActionsManager am = GetComponentInParent <ActionsManager>(); am.Attack(); }
private void EnablePower(ActionsManager actionsManager) { actionsManager.AuthorizeNewAction(actionToActivate); }
protected void Awake() { _actionsManager = ActionsManager.Instance; }
private void NodesGUI (bool isAsset) { if (AdvGame.GetReferences () && AdvGame.GetReferences ().actionsManager) { actionsManager = AdvGame.GetReferences ().actionsManager; } if (isAsset) { if (_targetAsset.actions.Count > 0 && (_targetAsset.actions[0].nodeRect.x == 0 || _targetAsset.actions[0].nodeRect.y == 0)) { PositionAllNodes (isAsset); } } else { if (_target.actions.Count > 0 && (_target.actions[0].nodeRect.x == 0 || _target.actions[0].nodeRect.y == 0)) { PositionAllNodes (isAsset); } } bool loseConnection = false; Event e = Event.current; if (e.isMouse && actionChanging != null && e.type == EventType.MouseUp) { loseConnection = true; } if (isAsset) { numActions = _targetAsset.actions.Count; if (numActions < 1) { numActions = 1; AC.Action newAction = ActionListEditor.GetDefaultAction (); newAction.hideFlags = HideFlags.HideInHierarchy; _targetAsset.actions.Add (newAction); AssetDatabase.AddObjectToAsset (newAction, _targetAsset); AssetDatabase.SaveAssets (); } numActions = _targetAsset.actions.Count; } else { numActions = _target.actions.Count; if (numActions < 1) { numActions = 1; AC.Action newAction = ActionListEditor.GetDefaultAction (); _target.actions.Add (newAction); } numActions = _target.actions.Count; } EditorZoomArea.Begin (zoom, new Rect (0, 0, position.width / zoom, position.height / zoom)); scrollPosition = GUI.BeginScrollView (new Rect (0, 0, position.width / zoom, position.height / zoom), scrollPosition, new Rect (0, 0, maxScroll.x, maxScroll.y), false, false); BeginWindows (); canMarquee = true; Vector2 newMaxScroll = Vector2.zero; for (int i=0; i<numActions; i++) { FixConnections (i, isAsset); Action _action; if (isAsset) { _action = _targetAsset.actions[i]; } else { _action = _target.actions[i]; } if (_action.nodeRect.x == 0 && _action.nodeRect.y == 0) { PositionNode (_action, isAsset); } //_action.nodeRect.height = 10; Color tempColor = GUI.color; if (_action.isRunning && Application.isPlaying) { GUI.color = Color.cyan; } else if (_action.isMarked) { GUI.color = new Color (0.7f, 1f, 0.6f); } if (deleteSkips > 0) { deleteSkips --; Rect originalRect = _action.nodeRect; _action.nodeRect = GUILayout.Window (i, _action.nodeRect, NodeWindow, i + ": " + _action.title, GUILayout.Width (300)); _action.nodeRect.x = originalRect.x; _action.nodeRect.y = originalRect.y; } else { if (_action.nodeRect.x < position.width / zoom + scrollPosition.x && (_action.nodeRect.x + 300) > scrollPosition.x) { _action.nodeRect = GUILayout.Window (i, _action.nodeRect, NodeWindow, i + ": " + _action.title, GUILayout.Width (300)); } } GUI.color = tempColor; if (_action.nodeRect.x + _action.nodeRect.width + 20 > newMaxScroll.x) { newMaxScroll.x = _action.nodeRect.x + _action.nodeRect.width + 200; } if (_action.nodeRect.height != 10) { if (_action.nodeRect.y + _action.nodeRect.height + 20 > newMaxScroll.y) { newMaxScroll.y = _action.nodeRect.y + _action.nodeRect.height + 200; } } LimitWindow (_action); DrawSockets (_action, isAsset); if (isAsset) { _targetAsset.actions = ActionListAssetEditor.ResizeList (_targetAsset, numActions); } else { _target.actions = ActionListEditor.ResizeList (_target.actions, numActions); } if (actionChanging != null && loseConnection && (new Rect (_action.nodeRect.x - 20, _action.nodeRect.y, 20, 20).Contains(e.mousePosition) || _action.nodeRect.Contains(e.mousePosition))) { Reconnect (actionChanging, _action, isAsset); } if (!isMarquee && _action.nodeRect.Contains (e.mousePosition)) { canMarquee = false; } } if (loseConnection && actionChanging != null) { EndConnect (actionChanging, e.mousePosition, isAsset); } if (actionChanging != null) { AdvGame.DrawNodeCurve (actionChanging.nodeRect, e.mousePosition, Color.cyan, offsetChanging); } if (e.type == EventType.ContextClick && actionChanging == null && !isMarquee) { menuPosition = e.mousePosition; CreateEmptyMenu (isAsset); } EndWindows (); GUI.EndScrollView (); EditorZoomArea.End(); if (newMaxScroll.y != 0) { maxScroll = newMaxScroll; } /*for (int i=0; i<numActions; i++) { Action _action; if (isAsset) { _action = _targetAsset.actions[i]; } else { _action = _target.actions[i]; } if ((_action.isRunning && Application.isPlaying) || _action.isMarked) { Rect selectedRect = _action.nodeRect; selectedRect.x -= scrollPosition.x; selectedRect.y -= scrollPosition.y; selectedRect.x *= zoom; selectedRect.y *= zoom; selectedRect.width *= zoom; selectedRect.height *= zoom; if (_action.isRunning && !isAsset && Application.isPlaying) { DrawStraightLine.DrawBox (selectedRect, Color.cyan, 10f, false, 5); } else if (_action.isMarked) { DrawStraightLine.DrawBox (selectedRect, new Color (0.7f, 1f, 0.6f, 0.7f), 10f, false, 5); } } }*/ }
public PeleaApi(Account _cuenta, ActionsManager _manejador_acciones) { cuenta = _cuenta; manejador_acciones = _manejador_acciones; }
private void Awake() { // Test for key imports References references = (References)Resources.Load(Resource.references); if (references) { SceneManager sceneManager = AdvGame.GetReferences().sceneManager; SettingsManager settingsManager = AdvGame.GetReferences().settingsManager; ActionsManager actionsManager = AdvGame.GetReferences().actionsManager; InventoryManager inventoryManager = AdvGame.GetReferences().inventoryManager; VariablesManager variablesManager = AdvGame.GetReferences().variablesManager; SpeechManager speechManager = AdvGame.GetReferences().speechManager; if (sceneManager == null) { Debug.LogError("No Scene Manager found - please set one using the Adventure Creator Kit wizard"); } if (settingsManager == null) { Debug.LogError("No Settings Manager found - please set one using the Adventure Creator Kit wizard"); } else { if (!GameObject.FindGameObjectWithTag(Tags.player)) { try { Player ref_player = AdvGame.GetReferences().settingsManager.player; Player player = (Player)Instantiate(ref_player); player.name = ref_player.name; } catch {} } } if (actionsManager == null) { Debug.LogError("No Actions Manager found - please set one using the Adventure Creator Kit wizard"); } if (inventoryManager == null) { Debug.LogError("No Inventory Manager found - please set one using the Adventure Creator Kit wizard"); } if (variablesManager == null) { Debug.LogError("No Variables Manager found - please set one using the Adventure Creator Kit wizard"); } if (speechManager == null) { Debug.LogError("No Speech Manager found - please set one using the Adventure Creator Kit wizard"); } if (GameObject.FindWithTag(Tags.player) == null) { Debug.LogError("No Player found - please set one using the Settings Manager, tagging it as Player"); } } else { Debug.LogError("No References object found. Please set one using the Adventure Creator Kit wizard."); } if (!GameObject.FindGameObjectWithTag(Tags.persistentEngine)) { try { GameObject persistentEngine = (GameObject)Instantiate(Resources.Load(Resource.persistentEngine)); persistentEngine.name = AdvGame.GetName(Resource.persistentEngine); } catch {} } if (GameObject.FindWithTag(Tags.persistentEngine) == null) { Debug.LogError("No PersistentEngine prefab found - please place one in the Resources directory, and tag it as PersistentEngine"); } else { GameObject persistentEngine = GameObject.FindWithTag(Tags.persistentEngine); if (persistentEngine.GetComponent <Options>() == null) { Debug.LogError(persistentEngine.name + " has no Options component attached."); } if (persistentEngine.GetComponent <RuntimeInventory>() == null) { Debug.LogError(persistentEngine.name + " has no RuntimeInventory component attached."); } if (persistentEngine.GetComponent <RuntimeVariables>() == null) { Debug.LogError(persistentEngine.name + " has no RuntimeVariables component attached."); } if (persistentEngine.GetComponent <StateHandler>() == null) { Debug.LogError(persistentEngine.name + " has no StateHandler component attached."); } if (persistentEngine.GetComponent <SceneChanger>() == null) { Debug.LogError(persistentEngine.name + " has no SceneChanger component attached."); } if (persistentEngine.GetComponent <SaveSystem>() == null) { Debug.LogError(persistentEngine.name + " has no SaveSystem component attached."); } if (persistentEngine.GetComponent <LevelStorage>() == null) { Debug.LogError(persistentEngine.name + " has no LevelStorage component attached."); } } if (GameObject.FindWithTag(Tags.mainCamera) == null) { Debug.LogError("No MainCamera found - please click 'Organise room objects' in the Scene Manager to create one."); } else { if (GameObject.FindWithTag(Tags.mainCamera).GetComponent <MainCamera>() == null) { Debug.LogError("MainCamera has no MainCamera component."); } } if (this.tag == Tags.gameEngine) { if (this.GetComponent <MenuSystem>() == null) { Debug.LogError(this.name + " has no MenuSystem component attached."); } if (this.GetComponent <Dialog>() == null) { Debug.LogError(this.name + " has no Dialog component attached."); } if (this.GetComponent <PlayerInput>() == null) { Debug.LogError(this.name + " has no PlayerInput component attached."); } if (this.GetComponent <PlayerInteraction>() == null) { Debug.LogError(this.name + " has no PlayerInteraction component attached."); } if (this.GetComponent <PlayerMenus>() == null) { Debug.LogError(this.name + " has no PlayerMenus component attached."); } if (this.GetComponent <PlayerMovement>() == null) { Debug.LogError(this.name + " has no PlayerMovement component attached."); } if (this.GetComponent <PlayerCursor>() == null) { Debug.LogError(this.name + " has no PlayerCursor component attached."); } if (this.GetComponent <SceneSettings>() == null) { Debug.LogError(this.name + " has no SceneSettings component attached."); } else { if (this.GetComponent <SceneSettings>().navMesh == null) { Debug.LogWarning("No NavMesh set. Characters will not be able to PathFind until one is defined - please choose one using the Scene Manager."); } if (this.GetComponent <SceneSettings>().defaultPlayerStart == null) { Debug.LogWarning("No default PlayerStart set. The game may not be able to begin if one is not defined - please choose one using the Scene Manager."); } } if (this.GetComponent <RuntimeActionList>() == null) { Debug.LogError(this.name + " has no RuntimeActionList component attached."); } } }
protected void DrawSharedElements() { if (AdvGame.GetReferences() == null) { Debug.LogError("A References file is required - please use the Adventure Creator window to create one."); EditorGUILayout.LabelField("No References file found!"); } else { actionsManager = AdvGame.GetReferences().actionsManager; ActionList _target = (ActionList)target; if (actionsManager) { int numActions = _target.actions.Count; if (numActions < 1) { numActions = 1; string defaultAction = actionsManager.GetDefaultAction(); _target.actions.Add((Action)CreateInstance(defaultAction)); } EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Expand all")) { Undo.RegisterUndo(_target, "Expand actions"); foreach (Action action in _target.actions) { action.isDisplayed = true; } } if (GUILayout.Button("Collapse all")) { Undo.RegisterUndo(_target, "Collapse actions"); foreach (Action action in _target.actions) { action.isDisplayed = false; } } EditorGUILayout.EndHorizontal(); for (int i = 0; i < _target.actions.Count; i++) { EditorGUILayout.BeginVertical("Button"); typeNumber = GetTypeNumber(i); string actionLabel = " " + (i).ToString() + ": " + _target.actions[i].title + _target.actions[i].SetLabel(); _target.actions[i].isDisplayed = EditorGUILayout.Foldout(_target.actions[i].isDisplayed, actionLabel); if (_target.actions[i].isDisplayed) { typeNumber = EditorGUILayout.Popup("Action type:", typeNumber, actionsManager.GetActionTitles()); EditorGUILayout.Space(); // Rebuild constructor if Subclass and type string do not match if (_target.actions[i].GetType().ToString() != actionsManager.GetActionName(typeNumber)) { _target.actions[i] = RebuildAction(_target.actions[i], typeNumber); } ShowActionGUI(_target.actions[i], _target.gameObject, i, _target.actions.Count); EditorGUILayout.BeginHorizontal(); if (i > 0) { if (GUILayout.Button("Move up")) { Undo.RegisterUndo(_target, "Move action up"); _target.actions = AdvGame.SwapActions(_target.actions, i, i - 1); } } if (i < _target.actions.Count - 1) { if (GUILayout.Button("Insert new")) { Undo.RegisterUndo(_target, "Create action"); numActions += 1; _target.actions = ResizeList(_target.actions, numActions); // Swap all elements up one for (int k = numActions - 1; k > i + 1; k--) { _target.actions = AdvGame.SwapActions(_target.actions, k, k - 1); } } } if (_target.actions.Count > 1) { if (GUILayout.Button("Delete")) { Undo.RegisterUndo(_target, "Delete action"); _target.actions.RemoveAt(i); numActions -= 1; } } if (i < _target.actions.Count - 1) { if (GUILayout.Button("Move down")) { Undo.RegisterUndo(_target, "Move action down"); _target.actions = AdvGame.SwapActions(_target.actions, i, i + 1); } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); } if (GUILayout.Button("Add new action")) { Undo.RegisterUndo(_target, "Create action"); numActions += 1; } _target.actions = ResizeList(_target.actions, numActions); } } }
public void UpdateManageActions(ActionsManager actionsManager, bool authorization) { actionsManager.UpdateAuthorizedActions(authorization); }
public override void OnInspectorGUI () { ActionListAsset _target = (ActionListAsset) target; actionsManager = AdvGame.GetReferences ().actionsManager; EditorGUILayout.BeginVertical ("Button"); EditorGUILayout.LabelField ("Asset properties", EditorStyles.boldLabel); _target.actionListType = (ActionListType) EditorGUILayout.EnumPopup ("When running:", _target.actionListType); if (_target.actionListType == ActionListType.PauseGameplay) { _target.isSkippable = EditorGUILayout.Toggle ("Is skippable?", _target.isSkippable); _target.unfreezePauseMenus = EditorGUILayout.Toggle ("Unfreeze 'pause' Menus?", _target.unfreezePauseMenus); } _target.useParameters = EditorGUILayout.Toggle ("Use parameters?", _target.useParameters); EditorGUILayout.EndVertical (); if (_target.useParameters) { ShowParametersGUI (_target); } EditorGUILayout.Space (); EditorGUILayout.BeginHorizontal (); if (GUILayout.Button ("Expand all", EditorStyles.miniButtonLeft)) { Undo.RecordObject (_target, "Expand actions"); foreach (AC.Action action in _target.actions) { action.isDisplayed = true; } } if (GUILayout.Button ("Collapse all", EditorStyles.miniButtonMid)) { Undo.RecordObject (_target, "Collapse actions"); foreach (AC.Action action in _target.actions) { action.isDisplayed = false; } } if (GUILayout.Button ("Action List Editor", EditorStyles.miniButtonMid)) { ActionListEditorWindow window = (ActionListEditorWindow) EditorWindow.GetWindow (typeof (ActionListEditorWindow)); window.Repaint (); } if (!Application.isPlaying) { GUI.enabled = false; } if (GUILayout.Button ("Run now", EditorStyles.miniButtonRight)) { AdvGame.RunActionListAsset (_target); } GUI.enabled = true; EditorGUILayout.EndHorizontal (); EditorGUILayout.Space (); for (int i=0; i<_target.actions.Count; i++) { typeNumber = ActionListEditor.GetTypeNumber (_target.actions[i]); if (_target.actions[i] == null) { _target.actions.Insert (i, ActionListAssetEditor.RebuildAction (_target.actions[i], typeNumber, _target)); } categoryNumber = ActionListEditor.GetCategoryNumber (typeNumber); subCategoryNumber = ActionListEditor.GetSubCategoryNumber (_target.actions[i].title, categoryNumber); _target.actions[i].isAssetFile = true; EditorGUILayout.BeginVertical("Button"); string actionLabel = " " + (i).ToString() + ": " + _target.actions[i].title + _target.actions[i].SetLabel (); EditorGUILayout.BeginHorizontal (); _target.actions[i].isDisplayed = EditorGUILayout.Foldout (_target.actions[i].isDisplayed, actionLabel); if (!_target.actions[i].isEnabled) { EditorGUILayout.LabelField ("DISABLED", EditorStyles.boldLabel, GUILayout.Width (100f)); } Texture2D icon = (Texture2D) AssetDatabase.LoadAssetAtPath ("Assets/AdventureCreator/Graphics/Textures/inspector-use.png", typeof (Texture2D)); if (GUILayout.Button (icon, GUILayout.Width (20f), GUILayout.Height (15f))) { ActionSideMenu (_target.actions[i]); } EditorGUILayout.EndHorizontal (); if (_target.actions[i].isDisplayed) { if (!actionsManager.DoesActionExist (_target.actions[i].GetType ().ToString ())) { EditorGUILayout.HelpBox ("This Action type has been disabled in the Actions Manager", MessageType.Warning); } else { EditorGUILayout.BeginHorizontal (); EditorGUILayout.LabelField ("Action type:", GUILayout.Width (150)); categoryNumber = EditorGUILayout.Popup(categoryNumber, actionsManager.GetActionCategories ()); subCategoryNumber = EditorGUILayout.Popup(subCategoryNumber, actionsManager.GetActionSubCategories (categoryNumber)); EditorGUILayout.EndVertical (); typeNumber = actionsManager.GetTypeNumber (categoryNumber, subCategoryNumber); // Rebuild constructor if Subclass and type string do not match if (_target.actions[i].GetType ().ToString () != actionsManager.GetActionName (typeNumber) && _target.actions[i].GetType ().ToString () != ("AC." + actionsManager.GetActionName (typeNumber))) { ActionEnd _end = new ActionEnd (); _end.resultAction = _target.actions[i].endAction; _end.skipAction = _target.actions[i].skipAction; _end.linkedAsset = _target.actions[i].linkedAsset; _end.linkedCutscene = _target.actions[i].linkedCutscene; Undo.RecordObject (_target, "Change Action type"); _target.actions.Insert (i, ActionListAssetEditor.RebuildAction (_target.actions[i], typeNumber, _target, _end.resultAction, _end.skipAction, _end.linkedAsset, _end.linkedCutscene)); } EditorGUILayout.Space (); GUI.enabled = _target.actions[i].isEnabled; if (_target.useParameters) { _target.actions[i].ShowGUI (_target.parameters); } else { _target.actions[i].ShowGUI (null); } } GUI.enabled = true; } if (_target.actions[i].endAction == AC.ResultAction.Skip || _target.actions[i] is ActionCheck || _target.actions[i] is ActionCheckMultiple) { _target.actions[i].SkipActionGUI (_target.actions, _target.actions[i].isDisplayed); } EditorGUILayout.EndVertical(); EditorGUILayout.Space (); } if (GUILayout.Button("Add new Action")) { AddAction (actionsManager.GetActionName (actionsManager.defaultClass), _target.actions.Count, _target); } if (GUI.changed) { EditorUtility.SetDirty (_target); } }
public NpcAPI(Account _cuenta, ActionsManager _manejador_acciones) { cuenta = _cuenta; manejador_acciones = _manejador_acciones; }
public AddModelCommand(ObservableCollection <T> collection, T model = default(T), ActionsManager manager = null) : base(model) { this.collection = collection; this.manager = manager; }
public AddModelCommand(ObservableCollection <T> collection, ActionsManager manager = null) : this(collection, default(T), manager) { }
public static void ModifyAction(ActionListAsset _target, AC.Action _action, string callback) { ActionsManager actionsManager = AdvGame.GetReferences().actionsManager; if (actionsManager == null) { return; } int i = -1; if (_action != null && _target.actions.IndexOf(_action) > -1) { i = _target.actions.IndexOf(_action); } switch (callback) { case "Enable": Undo.RecordObject(_target, "Enable action"); _target.actions [i].isEnabled = true; break; case "Disable": Undo.RecordObject(_target, "Disable action"); _target.actions [i].isEnabled = false; break; case "Cut": Undo.RecordObject(_target, "Cut action"); List <AC.Action> cutList = new List <AC.Action>(); AC.Action cutAction = Object.Instantiate(_action) as AC.Action; cutList.Add(cutAction); AdvGame.copiedActions = cutList; _target.actions.Remove(_action); UnityEngine.Object.DestroyImmediate(_action, true); AssetDatabase.SaveAssets(); break; case "Copy": List <AC.Action> copyList = new List <AC.Action>(); AC.Action copyAction = Object.Instantiate(_action) as AC.Action; copyAction.name = copyAction.name.Replace("(Clone)", ""); copyList.Add(copyAction); AdvGame.copiedActions = copyList; break; case "Paste after": Undo.RecordObject(_target, "Paste actions"); List <AC.Action> pasteList = AdvGame.copiedActions; int j = i + 1; foreach (AC.Action action in pasteList) { AC.Action pastedAction = Object.Instantiate(action) as AC.Action; pastedAction.name = pastedAction.name.Replace("(Clone)", ""); pastedAction.hideFlags = HideFlags.HideInHierarchy; _target.actions.Insert(j, pastedAction); j++; AssetDatabase.AddObjectToAsset(pastedAction, _target); AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(pastedAction)); } AssetDatabase.SaveAssets(); break; case "Insert after": Undo.RecordObject(_target, "Create action"); ActionListAssetEditor.AddAction(actionsManager.GetDefaultAction(), i + 1, _target); break; case "Delete": Undo.RecordObject(_target, "Delete action"); _target.actions.Remove(_action); UnityEngine.Object.DestroyImmediate(_action, true); AssetDatabase.SaveAssets(); break; case "Move to top": Undo.RecordObject(_target, "Move action to top"); _target.actions.Remove(_action); _target.actions.Insert(0, _action); break; case "Move up": Undo.RecordObject(_target, "Move action up"); _target.actions.Remove(_action); _target.actions.Insert(i - 1, _action); break; case "Move to bottom": Undo.RecordObject(_target, "Move action to bottom"); _target.actions.Remove(_action); _target.actions.Insert(_target.actions.Count, _action); break; case "Move down": Undo.RecordObject(_target, "Move action down"); _target.actions.Remove(_action); _target.actions.Insert(i + 1, _action); break; } }
public IEnumerator InitializeGame() { // ACA DEBERIA RECIBIR LA CONFIGURATION DATA DE CADA UNO // UNA VEZ QUE MIRROR ME DIGA "OK HERMANO", LOS DOS JUGADORES MANDARON SU CONFIGURATION DATA // ENTONCES AHI PUEDO VENIR A INITIALIZE GAME Y COMPROBAR LA PARTE DE FIREBASE Y SUS CONEXIONES // 0d- CHEQUEAR QUE LA BASE DE DATOS ESTE INITIALIZED //yield return WaitForDatabaseToLoad(); // REACTIVAR CUANDO FUNCIONE BIEN LA DB // 0- CHEQUEAR QUE LOS DOS JUGADORES ESTEN EN LINEA Y LISTOS PARA JUGAR. // 0b- CHEQUEAR QUE LOS DOS JUGADORES EXISTAN // 4- CARGAR EL DECK SELECCIONADO DE CADA JUGADOR // 4b- CHEQUEAR QUE SEA UN DECK VALIDO // 4c- SI ES INVALIDO SACAMOS TODO A LA MIERDA, SI ES VALID CREAMOS LOS DECKS DE CADA PLAYER // CREATE PLAYERS STATE // 1 - CREAR PLAYERS Y USERS // 0c- SEGUN EL JUGADOR QUE HAYA CREADO LA PARTIDA ESE SERA EL PLAYER ONE, NO SIGNIFICA QUE VA A EMPEZAR PRIMERO playerManager = new PlayerManager(); playerManager.CreatePlayers(); playerManager.CreateNewUser(null); // CREATE BOARD STATE // 3- IR CREANDO EL BOARD board2DManager = new Board2DManager(board2DManagerUI, 5, 7); //Motion motion = board2DManager.CreateBoard(playerManager.GetPlayer(), OnBoardComplete); //InvokerMotion.AddNewMotion(motion); //InvokerMotion.StartExecution(this); Animotion motion = board2DManager.CreateBoardAnimotion(playerManager.GetPlayer(), OnBoardComplete); InvokerAnimotion.AddNewMotion(motion); InvokerAnimotion.StartExecution(this); // CREATE TURNS STATE => ESTO LO DEBERIA HACER EL SERVER PARA QUE NO LO HAGA CADA JUGADOR Y SE PUEDE HACKEAR // 2- ASIGNAR LOS PLAYER AL TURN MANAGER turnController = new TurnController(playerManager.GetPlayer()); // 2b - DECIDIR QUE PLAYER COMIENZA PRIMERO turnController.DecideStarterPlayer(); // CREATE MANAGER STATE // 3b - Inicializar los managers generales ESTOS LOS VA A TENER EL GAME... ASI QUE SEGURO LO HAGAMOS DESDE AHI spawnManager = new SpawnManager(spawnManagerUI, this); combineManager = new CombineManager(this, combineManagerUI); movementManager = new MovementManager(this, moveManagerUI); actionsManager = new ActionsManager(); yield return(null); // LOADCOLLECTIONSTATE => LAS COLLECTION LAS DEBERIA TENER EL SERVER Y PASARSELAS A CADA JUGADOR // 3- CARGAR LA GAME COLLECTION InGameCardCollectionManager inGameCardCollectionManager = new InGameCardCollectionManager(this, OnCardCollectionLoadComplete); //inGameCardCollectionManager.LoadAllCollection(users);// REACTIVAR CUANDO FUNCIONE BIEN LA DB inGameCardCollectionManager.LoadAllCollectionJson(playerManager.GetUsers().ToArray()); while (isCardCollectionLoaded == false) { if (logOn) { Debug.Log("WAITING FOR CARD COLLECTION TO LOAD"); } yield return(null); } if (logOn) { Debug.Log("GAME CARD COLLECTION LOADED"); } // CREATEDECKSTATE cardManager = new CardController(inGameCardCollectionManager, cardManagerUI, this); // VOLVER A ACTIVAR QUE ESTA ES LA FORMA DE CARGAR EL DECK SEGUN LA INFO DE LOS PLAYERS //cardManager.LoadDeckFromConfigurationData(playerManager.GetPlayer()[0], playerManager.playerConfigurationData); //cardManager.LoadDeckFromConfigurationData(playerManager.GetPlayer()[1], playerManager.playerConfigurationData); cardManager.LoadDeckTest(playerManager.GetPlayer()[0]); cardManager.LoadDeckTest(playerManager.GetPlayer()[1]); // WAIT FOR BOARD TO LOAD STATE while (isBoardLoaded == false) { if (logOn) { Debug.Log("WAITING FOR BOARD TO LOAD"); } yield return(null); } // INITIALIZECONTROLLERSTATE // 5 - INICIALIZAMOS LOS CONTROLES mouseController = new MouseController(0, board2DManager, Camera.main); keyBoardController = new KeyBoardController(0, board2DManager, Camera.main); tileSelectionManagerUI.SetController(board2DManager, mouseController, keyBoardController); // STARTGAMESTATE => ACA DEBERIA MANDAR CADA JUGADOR QUE ESTA READY, Y AHI EL SERVER EMITIRIA EL NUEVO STATE PARA CADA UNO // CREAMOS EL STATE INICIAL AdministrationState AdminState = new AdministrationState(10, this, 1); TurnState turnState = new TurnState(50, this); InitialAdministrationStateA initialAdminStateA = new InitialAdministrationStateA(40, this, 4); //Motion bannerMotion = informationUIManager.SetAndShowBanner(initialAdminStateA.stateName, 0.5f); //InvokerMotion.AddNewMotion(bannerMotion); //InvokerMotion.StartExecution(this); //Debug.Log("CREATING BANNER"); Animotion bannerMotion = informationUIManager.SetAndShowBannerAnimotion(initialAdminStateA.stateName, 0.5f); InvokerAnimotion.AddNewMotion(bannerMotion); InvokerAnimotion.StartExecution(this); IState changePhaseState = new ChangePhaseState(this, initialAdminStateA); baseStateMachine = new BaseStateMachine(this); baseStateMachine.PushState(changePhaseState, true); baseStateMachine.Initialize(); // DEBERIA DIVIR PLAYER == BASE NEXUS Y GAME PLAYER == JUGADOR EN SI QUE VA A ENVIAR LOS COMANDOS... // PODRIAMOS TENER UN GAME PLAYER QUE LO UNICA QUE VA A TENER ES UNA ID // ENTONCES CUANDO // game.actionsManager.IncrementPlayerActions(game.turnController.CurrentPlayerTurn, managmentPoints); // ESTO DEBARA CAMBIARSE game.turnController.CurrentPlayerTurn // SI UN JUGADOR APRETA UNA UNIDAD... COMO SABEMOS SI MOSTRAR O NO LA UI DE LOS BOTONES // POR QUE SOLO PODEMOS MOSTRARLA EN TURN STATE, OK, Y SOLO CON UNIDADES NUESTRAS OK // Y SI ACTIVAMOS EL BOTON ENTONCES IGUAL SIEMPRE VAMOS A SER NOSOTROS TECNICAMENTE... // POR QUE EL BOTON SE CREA CON EL OCUPIER O CON EL PLAYER EN ESTE CASO... // // // YA QUE ESTOY ENTRANDO A UN NUEVO STATE game.actionsManager.IncrementPlayerActions LO DEBARIA REALIZAR EL SERVER // // REALIZA SI O SI JUGADOR //// 1 - SUSCRIBIRSE AL EVENTO DE SELECCION ESTO SI LO TIENE QUE HACER EL JUGADOR //gmMachine.tileSelectionManagerUI.onTileSelected += ExecuteAction; //ExecuteAction(Tile action) //if (action == null) //{ // gmMachine.abilityButtonCreationUI.SetUnit(game.turnController.CurrentPlayerTurn); //} // ESTO LO HACE EL SERVER, VUELVE A REAHBILITAR LOS BOTONES DEL JUGADOR PARA SPAWN O TAKE CARD // SOLO JUGADOR YA QUE ES PARA LA UI //// NOS SUSCRIBIMOS AL EVENTO DE CAMBIAR EL TIEMPO //gameTimer.OnTimePass += gmMachine.uiGeneralManagerInGame.UpdateTime; // DEBE REALIZARLO SERVER //// 2 - TENGO QUE SETEAR LOS ACTIONS POINTS PARA ESTE JUGADOR //game.actionsManager.IncrementPlayerActions(game.turnController.CurrentPlayerTurn, managmentPoints); // DEBE REALIZARLO SERVER Y ENVIAR EL END STATE EN TODO CASO //// COMENZAMOS EL CONTADOR DE TIEMPO //base.OnEnter(); // DEBE REALIZARLO SERVER ???? //gmMachine.abilityButtonCreationUI.SetUnit(game.turnController.CurrentPlayerTurn); }
private void StroopMainForm_Load(object sender, EventArgs e) { // Temp: Remove "Other" tab #if RELEASE tabControlMain.TabPages.Remove(tabPageExpressions); #endif // Create new manager context var currentContext = new ManagerContext(); ManagerContext.Current = currentContext; Config.Stream = new ProcessStream(); Config.Stream.OnUpdate += OnUpdate; Config.Stream.FpsUpdated += _sm64Stream_FpsUpdated; Config.Stream.OnDisconnect += _sm64Stream_OnDisconnect; Config.Stream.WarnReadonlyOff += _sm64Stream_WarnReadonlyOff; Config.Stream.OnClose += _sm64Stream_OnClose; currentContext.DisassemblyManager = _disManager = new DisassemblyManager(tabPageDisassembly); currentContext.ScriptManager = _scriptManager = new ScriptManager(_scriptParser, checkBoxUseRomHack); currentContext.HackManager = _hackManager = new HackManager(_romHacks, Config.ObjectAssociations.SpawnHacks, tabPageHacks); // Create map manager MapGui mapGui = new MapGui(); mapGui.GLControl = glControlMap; mapGui.MapIdLabel = labelMapId; mapGui.MapNameLabel = labelMapName; mapGui.MapSubNameLabel = labelMapSubName; mapGui.PuValueLabel = labelMapPuValue; mapGui.QpuValueLabel = labelMapQpuValue; mapGui.MapIconSizeTrackbar = trackBarMapIconSize; mapGui.MapZoomTrackbar = trackBarMapZoom; mapGui.MapShowInactiveObjects = checkBoxMapShowInactive; mapGui.MapShowMario = checkBoxMapShowMario; mapGui.MapShowHolp = checkBoxMapShowHolp; mapGui.MapShowIntendedNextPosition = checkBoxMapShowIntendedNextPosition; mapGui.MapShowCamera = checkBoxMapShowCamera; mapGui.MapShowFloorTriangle = checkBoxMapShowFloor; mapGui.MapShowCeilingTriangle = checkBoxMapShowCeiling; currentContext.MapManager = _mapManager = new MapManager(_mapAssoc, mapGui); currentContext.ModelManager = _modelManager = new ModelManager(tabPageModel); currentContext.ActionsManager = _actionsManager = new ActionsManager(_actionsData, noTearFlowLayoutPanelActions, tabPageActions); currentContext.WaterManager = _waterManager = new WaterManager(_waterData, noTearFlowLayoutPanelWater); currentContext.InputManager = _inputManager = new InputManager(_inputData, tabPageInput, NoTearFlowLayoutPanelInput, _inputImageGui); currentContext.MarioManager = _marioManager = new MarioManager(_marioData, tabPageMario, NoTearFlowLayoutPanelMario, _mapManager); currentContext.HudManager = _hudManager = new HudManager(_hudData, tabPageHud, NoTearFlowLayoutPanelHud); currentContext.MiscManager = _miscManager = new MiscManager(_miscData, NoTearFlowLayoutPanelMisc, tabPageMisc); currentContext.CameraManager = _cameraManager = new CameraManager(_cameraData, tabPageCamera, NoTearFlowLayoutPanelCamera); currentContext.TriangleManager = _triangleManager = new TriangleManager(tabPageTriangles, _triangleData, NoTearFlowLayoutPanelTriangles); currentContext.DebugManager = _debugManager = new DebugManager(_debugData, tabPageDebug, noTearFlowLayoutPanelDebug); currentContext.PuManager = _puManager = new PuManager(groupBoxPuController); currentContext.FileManager = _fileManager = new FileManager(_fileData, tabPageFile, noTearFlowLayoutPanelFile, _fileImageGui); currentContext.QuarterFrameManager = _quarterFrameManager = new DataManager(_quarterFrameData, noTearFlowLayoutPanelQuarterFrame); currentContext.CameraHackManager = _cameraHackManager = new CamHackManager(_camHackData, tabPageCamHack, noTearFlowLayoutPanelCamHack); currentContext.ObjectManager = _objectManager = new ObjectManager(_objectData, tabPageObjects, NoTearFlowLayoutPanelObject); currentContext.OptionsManager = _optionsManager = new OptionsManager(tabPageOptions); currentContext.TestingManager = _testingManager = new TestingManager(tabPageTesting); // Create Object Slots _slotManagerGui.TabControl = tabControlMain; _slotManagerGui.LockLabelsCheckbox = checkBoxObjLockLabels; _slotManagerGui.FlowLayoutContainer = NoTearFlowLayoutPanelObjects; _slotManagerGui.SortMethodComboBox = comboBoxSortMethod; _slotManagerGui.LabelMethodComboBox = comboBoxLabelMethod; currentContext.ObjectSlotManager = _objectSlotManager = new ObjectSlotsManager(_objectManager, _slotManagerGui, _mapManager, _miscManager, _modelManager, tabControlMain); SetupViews(); _resizing = false; labelVersionNumber.Text = _version; // Collect garbage, we are fully loaded now! GC.Collect(); GC.WaitForPendingFinalizers(); // Load process buttonRefresh_Click(this, new EventArgs()); panelConnect.Location = new Point(); panelConnect.Size = this.Size; }
public ActionsManager() { Current = this; }
// Use this for initialization void Start() { mMonsterDog = new Creature("Monster Dog"); mMonsterCat = new Creature("Monster Cat"); // objects InitMoveableObjects(); // actions mActions = new ActionsManager(ref mObjects); InitActions(); }
public void CallManageActions(ActionsManager actionsManager) { StartCoroutine(ManageActions(actionsManager)); }
public void RemoveActionsManager() { actionsManager = null; }
void Start() { actionsManager = GetComponent <ActionsManager>(); }
/// <summary> /// Calculate the best decision of action to satisfy need /// </summary> /// <param name="argNeed">need, that must be satisfied</param> protected virtual void MakeAction(Need argNeed) { Exception worldResponseToAction = new Exception(); //World response if the action is accepted. ActionAbstract newAction = null; //New action to create if (argNeed.SatisfyingActions.Count == 0) { logger.Error("Number of Action to satisfy need {0} is 0", argNeed); return; } foreach (Type act in argNeed.SatisfyingActions) { Attribute actionInfo = Attribute.GetCustomAttribute(act, typeof(ActionInfoAttribute)); // getting attributes for this class if (actionInfo == null) { logger.Error("Failed to get action info attribute for {0}", act.GetType()); return; } ActionInfoAttribute currentInfo = actionInfo as ActionInfoAttribute; //Converting attribute to ActionInfo if (currentInfo.RequiresObject) { foreach (Agent ag in Inventory.ItemList.Concat(CurrentVision.CurrentViewAgents)) { if (!currentInfo.AcceptedObjects.Contains(ag.GetType())) { continue; } if (Distance(this, ag) > Math.Sqrt(2)) { actionInfo = Attribute.GetCustomAttribute(typeof(ActionGo), typeof(ActionInfoAttribute)); // getting attributes for this class if (actionInfo == null) { logger.Error("Failed to get action info attribute for ActionGo"); return; } currentInfo = actionInfo as ActionInfoAttribute; newAction = ActionsManager.GetActionForCurrentParticipants(typeof(ActionGo), currentInfo, this, null, ag.CurrentLocation.Coords); worldResponseToAction = HomeWorld.AskWorldForAction(newAction); if (worldResponseToAction == null) { break; } } newAction = ActionsManager.GetActionForCurrentParticipants(act, currentInfo, this, ag); worldResponseToAction = HomeWorld.AskWorldForAction(newAction); if (worldResponseToAction == null) { break; } } } else { newAction = ActionsManager.GetActionForCurrentParticipants(act, currentInfo, this, null); worldResponseToAction = HomeWorld.AskWorldForAction(newAction); } if (worldResponseToAction == null) { logger.Debug("Made action for {0}: {1}", this.Name, newAction.Name); break; } } }
// Use this for initialization void Start() { if(!PlayerPrefs.HasKey("Terror Nights Slept")) { PlayerPrefs.SetInt("Terror Nights Slept", 0); } _nightTerrorNightsSlept = PlayerPrefs.GetInt("Terror Nights Slept"); _am = transform.GetComponent<ActionsManager>(); _character = GameObject.Find("Character").GetComponent<Character>(); FirstPlay = CheckFirstPlay(); if(FirstPlay) { Debug.Log("Setting hint wait time to 2."); _am.SetHintWaitTime(2); } if(PlayerPrefs.GetInt("Games Played") == 3) { NightTerrorState = true; } // During a night terror. if (NightTerrorState) { Debug.Log("Terror Night Event Active!"); // Saves current emotional state temporarily. if (_savedState == false) { _tempEmotionalStateValue = _character.GetEmotionalStateValue(); _savedState = true; } switch (_nightTerrorNightsSlept) { // First Night // Set hint time to 5 and character state to terror if it's the first night terror event night. case 0: Debug.Log("First night of terror!"); if (_am.HintWaitTime != 5) { _am.SetHintWaitTime(5); } _character.SetEmotionalStateValue(10); break; // Second Night case 1: Debug.Log("Second night of terror!"); if (_am.HintWaitTime != 5) { _am.SetHintWaitTime(5); } break; // Third Night case 2: Debug.Log("Third night of terror!"); if (_am.HintWaitTime != 5) { _am.SetHintWaitTime(5); } break; // End the night terror event here. case 3: Debug.Log("Ending night of terror!"); if (_am.HintWaitTime != 5) { _am.SetHintWaitTime(5); } SetNightTerrorState(false); ResetNightTerrorSlept(); _character.SetEmotionalStateValue(120f); break; default: if (_am.HintWaitTime != 5) { Debug.Log("DEFAULT CASE:"); Debug.Log("Nights slept: " + _nightTerrorNightsSlept + ". Setting Hint timer to: 5."); _am.SetHintWaitTime(5); } _character.SetEmotionalStateValue(_tempEmotionalStateValue); NightTerrorState = false; break; } } else { if(!FirstPlay) { _am.SetHintWaitTime(5); } SetNightTerrorSlept(0); CheckForRandomNightTerrorEvent(); } }
public InventarioApi(Account _cuenta, ActionsManager _manejar_acciones) { cuenta = _cuenta; manejar_acciones = _manejar_acciones; }