public void Act() { if (_action) { _action.Act(); } }
protected virtual void LeftClick() { if (action != null) { action.Act(); } }
/** * Runs all the active actions, deleting any that * complete. This is called automatically by the execute * function. */ protected void RunActive() { Action previous = Active; Action next = Active; while (next != null) { // Do the action first next.Act(); // Check if we're done with this action if (next.IsComplete()) { // Remove it from the list previous = next.Next; // Keep a temp of what we're about to delete Action temp = next; // Move the next pointer only along (previous stays) next = next.Next; // And delete the item //delete temp; } else { // We're not done, just chug along previous = next.Next; next = next.Next; } } }
public void Interaction() { if (interaction) { interaction.Act(this); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void perform(Action action) throws Exception private void Perform(Action action) { ExecutorService service = Executors.newFixedThreadPool(_lifecycles.Count); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.List<java.util.concurrent.Future<?>> futures = new java.util.ArrayList<>(); IList <Future <object> > futures = new List <Future <object> >(); foreach (Lifecycle lifecycle in _lifecycles) { futures.Add(service.submit(() => { try { action.Act(lifecycle); } catch (Exception e) { throw new Exception(e); } })); } service.shutdown(); if (!service.awaitTermination(_timeout, _unit)) { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: for (java.util.concurrent.Future<?> future : futures) foreach (Future <object> future in futures) { future.cancel(true); } } Exception exception = null; //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: for (java.util.concurrent.Future<?> future : futures) foreach (Future <object> future in futures) { try { future.get(); } catch (Exception e) when(e is InterruptedException || e is ExecutionException) { if (exception == null) { exception = new Exception(); } exception.addSuppressed(e); } } if (exception != null) { throw exception; } }
/// <summary> /// /// </summary> /// <param name="gameTime"></param> public virtual void Act(GameTime gameTime) { if (Action != null && Enabled) { if (Action.Act(gameTime)) { Action.Target = null; Action = null; } } }
/** * Called to make the action do its stuff. It calls all its * subactions. */ public override void Act() { Action next = SubActions; while (next != null) { if (!next.IsComplete()) { next.Act(); } next = next.Next; } }
private void calculate_utility(StateController controller) { int highest_utility = int.MinValue; for (int i = 0; i < actions.Length; i++) { int cur_util = actions[i].get_utility(controller); //Debug.Log("Calculated utility of " + actions[i].name + " as " + cur_util.ToString()); if (cur_util > highest_utility) { best_choice = actions[i]; highest_utility = cur_util; } } //Debug.Log(controller.attached_character.gameObject.name + " did action " + best_choice.name); best_choice.Act(controller); }
// Update is called once per frame void Update() { if (highlighted) { if (mat.color != Color.cyan) { mat.color = Color.cyan; } if (Input.GetKeyDown(KeyCode.F)) { action.Act(); } } else if (mat.color != originalColor) { mat.color = originalColor; } }
void Beat() { beater.Beat(); heart1.Beat(); heart2.Beat(); flash.GetComponent <Image>().enabled = false; flashCount = 0; p1.Tire(); p2.Tire(); p1.Regen(); p2.Regen(); Action p1Action = p1.Parse(p1queue); Action p2Action = p2.Parse(p2queue); p1Action.Fatigue(); p2Action.Fatigue(); p1Action.Act(); p2Action.Act(); p1queue = ""; p2queue = ""; p1.heartPoints = Mathf.Min(p1.heartMax, p1.heartPoints); p2.heartPoints = Mathf.Min(p2.heartMax, p2.heartPoints); if (p1.heartPoints <= 0) { Knockout(p1); } if (p2.heartPoints <= 0) { Knockout(p2); } if (p1Listener is AIListener) { ((AIListener)p1Listener).hasTyped = false; } if (p2Listener is AIListener) { ((AIListener)p2Listener).hasTyped = false; } }
override protected void Effect() { //Try to figure out how to figure out whether the direction you are facing is opposite of the attack key you press so that you can flip. front = actor.isFront; Player current = actor; Player target = actor.enemy; float targPos = target.GetComponent <Transform>().position.x; float actorPos = actor.GetComponent <Transform>().position.x; float trueOffset = current.facingRight? offset: -offset; //This makes sure that if you're in the front and facing right, you hit to the right, and if you're facing left, you hit to the left. if (front) { if (Mathf.Abs(actorPos - targPos + trueOffset) < range) { target.Hit(strength); if (current.facingRight) { //If facing right and you use the left attack key, flip the character. if (current.getActions().Contains("Q")) { Action paction = current.Parse("S"); paction.Act(); } //Opens certain animator animations based on the call set by buttons current.GetComponent <Animator>().SetTrigger(actionName); } else { //If you're facing left and you hit the right attack key, flip the character. if (current.getActions().Contains("E")) { Action paction = current.Parse("S"); paction.Act(); } current.GetComponent <Animator>().SetTrigger(invName); } } else { current.GetComponent <Animator>().SetTrigger(missName); } } //This does the same to the player in the back. facing left hits left, facing right hits right, so you can actually hit the other player. else { if (Mathf.Abs(targPos - actorPos + trueOffset) < range) { target.Hit(strength); if (current.facingRight) { //Opens certain animator animations based on the call set by buttons current.GetComponent <Animator>().SetTrigger(actionName); } else { current.GetComponent <Animator>().SetTrigger(invName); } } else { current.GetComponent <Animator>().SetTrigger(missName); } } }
public void displayInfo(string errorMessage = "") { Player currentPlayer = Program.newGame.newPlayer; long ticks = new DateTime(2021, 04, 28, new CultureInfo("en-US", false).Calendar).Ticks; this.dateVisited = new DateTime(ticks); string displayDate = this.dateVisited.AddDays(lastVisited).ToString("MMMM dd, yyyy"); string currentDate = this.dateVisited.AddDays(currentPlayer.travelDays).ToString("MMMM dd, yyyy"); System.Console.Clear(); // System.Console.WriteLine("Trying to display Options"); System.Console.Write($@" ################################################################# # # {locationArt} {description} # # # Pick from the following options # # by typing the option number or the full name # ################################################################# Ship: {currentPlayer.currentShip.name} Gold: {currentPlayer.gold}, Cargo Space: {currentPlayer.currentShip.currentSpace}/{currentPlayer.currentShip.cargoSpace} Current Date: {currentDate}, Days Traveled: {currentPlayer.travelDays} Last Visited: {displayDate}, Days Elapsed: {currentPlayer.travelDays - lastVisited} {errorMessage.PadRight(52)} "); for (int j = 0; j < actions.Count; j++) { if (j == 2) { System.Console.Write(@" "); } System.Console.Write( $@" {j} - {actions[j].name} |" ); } System.Console.Write(@" What will you do?"); string answer = System.Console.ReadLine(); Action choice = null; for (int i = 0; i < actions.Count; i++) { if (answer == actions[i].name || answer == i.ToString()) { choice = actions[i]; } } // System.Console.WriteLine(choice.name); if (choice == null) { currentPlayer.currentLocation.displayInfo("That is not a valid selection"); } else { choice.Act(); } currentPlayer.currentLocation.displayInfo(); }
/// <summary> /// update state method calling every frame /// </summary> /// <param name="controller"></param> public void UpdateState(StateController controller) { action.Act(controller); CheckTransitions(controller); }
// Update is called once per frame void Update() { action.Act(); }