public static ActionDist NonActions(float[] weights) { Debug.Assert(weights.GetLength(0) == 4); ActionWeightPair[] a = new ActionWeightPair[] { new ActionWeightPair(new NonAction(), weights[0]), new ActionWeightPair(new NonAction(), weights[1]), new ActionWeightPair(new NonAction(), weights[2]), new ActionWeightPair(new NonAction(), weights[3]) }; return(new ActionDist(a)); }
public override ActionDist Execute(ActionInfo info) { ActionWeightPair[] weightedActions = new ActionWeightPair[4]; Vector2Int[] dirs = { new Vector2Int(0, 1), new Vector2Int(0, -1), new Vector2Int(1, 0), new Vector2Int(-1, 0), }; for (int i = 0; i < dirs.Length; i++) { weightedActions[i] = new ActionWeightPair ( new DirectionalShot(info, dirs[i]), 0.25f ); } return(new ActionDist(weightedActions)); }
public override ActionDist Execute(ActionInfo info) { ActionWeightPair[] weightedActions = new ActionWeightPair[4]; int[] quadrants = { 1, 2, 3, 4 }; for (int i = 0; i < quadrants.Length; i++) { weightedActions[i] = new ActionWeightPair ( new LocalDOOM(info, quadrants[i]), 0.25f ); } return(new ActionDist(weightedActions)); }
public override ActionDist Execute(ActionInfo info) { ActionWeightPair[] weightedActions = new ActionWeightPair[4]; if (info.targetId != World.InvalidId && info.originId != World.InvalidId) { weightedActions[0] = new ActionWeightPair(new SwapAction(info), 1); weightedActions[1] = new ActionWeightPair(new NonAction(), 0); weightedActions[2] = new ActionWeightPair(new NonAction(), 0); weightedActions[3] = new ActionWeightPair(new NonAction(), 0); return(new ActionDist(weightedActions)); } else { return(ActionDist.DegeneratedNonActions()); } }
public override ActionDist Execute(ActionInfo info) { ActionWeightPair[] weightedActions = new ActionWeightPair[4]; if (info.targetId != World.InvalidId && info.originId != World.InvalidId) { Vector2Int[] moves = { new Vector2Int(0, 1), new Vector2Int(0, -1), new Vector2Int(1, 0), new Vector2Int(-1, 0), }; for (int i = 0; i < moves.Length; i++) { weightedActions[i] = new ActionWeightPair ( new MoveAction(info, moves[i]), 0.25f ); } return(new ActionDist(weightedActions)); } else { return(ActionDist.DegeneratedNonActions()); } }