private GameEvent parseEvent(GameEvent ge) { foreach (string contenido_param in ge.Params) { object param = ge.getParameter(contenido_param); if (contenido_param.Equals("direction")) { Mover.Direction t = new Mover.Direction(); switch ((System.String)param) { case "North": ge.setParameter(contenido_param, t); break; case "East": ge.setParameter(contenido_param, t + 1); break; case "South": ge.setParameter(contenido_param, t + 2); break; case "West": ge.setParameter(contenido_param, t + 3); break; } } else { if (param.GetType() == typeof(System.Int32)) { int intParam = (int)param; if (EntityMap.getInstance().getEntityMap().ContainsKey(intParam)) { UnityEngine.Object go_src; EntityMap.getInstance().getEntityMap().TryGetValue(intParam, out go_src); ge.setParameter(contenido_param, go_src); } }/* else { Debug.Log("===================================="); Debug.Log("tipo: " + param.GetType() + ", valor: " + param); Debug.Log("===================================="); }*/ } } return ge; }
public override void tick() { if (toLaunch != null) { // If we're not waiting to receive event finished from Mover. if (movement == null) { // That means that, we're in the right position so... Game.main.enqueueEvent(toLaunch); toLaunch = null; // Look to the action Mover.Direction toLook = Mover.getDirectionFromTo(this.Entity.Position.transform, actionCell.transform); this.GetComponent <Mover>().switchDirection(toLook); actionCell = null; } } if (!registered) { ControllerManager.onControllerEvent += this.onControllerEvent; registered = true; } }
public override void tick() { if (toLaunch != null) { // If we're not waiting to receive event finished from Mover. if (movement == null) { // That means that, we're in the right position so... Game.main.enqueueEvent(toLaunch); toLaunch = null; // Look to the action if (actionCell || actionEntity) { Mover.Direction toLook = Mover.getDirectionFromTo(Entity.transform, actionEntity ? actionEntity.transform : actionCell.transform); GameEvent ge = new GameEvent("turn"); ge.setParameter("mover", Entity.mover); ge.setParameter("direction", toLook); Game.main.enqueueEvent(ge); } actionCell = null; actionEntity = null; } } if (!registered) { ControllerManager.onControllerEvent += this.onControllerEvent; registered = true; } }
//Works just like Move(), except the player will attack and the enemies will get a turn to move public void Attack(Mover.Direction direction, Random random) { player.Attack(direction, random); foreach (Enemy enemy in enemies) { enemy.Move(random); } }
public override void eventHappened(IGameEvent ge) { if (ge.getParameter("Talker") == this) { switch (ge.Name.ToLower()) { case "talk": start = true; talkerDirection = ((Entity)ge.getParameter("Executer")).GetComponent <Mover>().direction; break; } } }
private GameEvent parseEvent(GameEvent ge) { foreach (string contenido_param in ge.Params) { object param = ge.getParameter(contenido_param); if (contenido_param.Equals("direction")) { Mover.Direction t = new Mover.Direction(); switch ((System.String)param) { case "North": ge.setParameter(contenido_param, t); break; case "East": ge.setParameter(contenido_param, t + 1); break; case "South": ge.setParameter(contenido_param, t + 2); break; case "West": ge.setParameter(contenido_param, t + 3); break; } } else { if (param.GetType() == typeof(System.Int32)) { int intParam = (int)param; if (EntityMap.getInstance().getEntityMap().ContainsKey(intParam)) { UnityEngine.Object go_src; EntityMap.getInstance().getEntityMap().TryGetValue(intParam, out go_src); ge.setParameter(contenido_param, go_src); } }/* else { * Debug.Log("===================================="); * Debug.Log("tipo: " + param.GetType() + ", valor: " + param); * Debug.Log("===================================="); * }*/ } } return(ge); }
private void Attack(Mover.Direction direction) { game.Attack(direction, random); UpdateCharacters(); }
private void Move(Mover.Direction direction) { game.Move(direction, random); UpdateCharacters(); }