void Awake() { character_movement = GetComponent <PlayerMoveAction>(); look_Position = transform.GetChild(0); player_movement = GetComponentInChildren <MovementSound>(); player_statistics = GetComponent <PlayerStatistics>(); }
public bool PortalInteract(PlayerMoveAction player, List <List <int> > ListMap) { var pos = player.Pos; switch (player.Direction) { case Key.Up: pos.Y -= 1; break; case Key.Down: pos.Y += 1; break; case Key.Left: pos.X -= 1; break; case Key.Right: pos.X += 1; break; } if (ListMap[(int)pos.X][(int)pos.Y] == 4) { return(true); } return(false); }
// Adds a new record of the Player's movement to the State if it doesn't exist. If it does, then it updates the Action's weight public void addAction(double[] stateVals, GameObjectState moveState) { List <NodeDistance <KDTreeNode <PlayerMoveAction> > > foundActions = actionsAvailable.Nearest(stateVals, GameState.voxel_radius); if (foundActions.Count < 1) { PlayerMoveAction newMove = new PlayerMoveAction("Move", 0.05); newMove.stateChange = moveState; actionsAvailable.Add(stateVals, newMove); addAction(newMove); if (numActionsMade < maxActionsMade) { numActionsMade++; newMove.updateProbabilityFromActionStateCount(numActionsMade); } } else { foreach (var action in foundActions) { if (numActionsMade < maxActionsMade) { numActionsMade++; action.Node.Value.updateProbabilityFromActionStateCount(numActionsMade); } } } }
public void SetPlayerOnMapData(PlayerMoveAction player) { if (ListMap[(int)player.Pos.X][(int)player.Pos.Y] != 3) { SetZeroOnMapData(player.LastPos); ListMap[(int)player.Pos.X][(int)player.Pos.Y] = 2; } }
public void SetPlayerOnMap(PlayerMoveAction MoveAction, Canvas MapCanvas, Canvas CharacterField) { var PlayerCanvas = (Canvas)CharacterField.Children[0]; Canvas.SetLeft(PlayerCanvas, MoveAction.BegPos.X + (MoveAction.Pos.X * 26)); Canvas.SetTop(PlayerCanvas, MoveAction.BegPos.Y + (MoveAction.Pos.Y * 26)); Canvas.SetLeft(MapCanvas, MoveAction.Pos.X * -26); Canvas.SetTop(MapCanvas, MoveAction.Pos.Y * -26); }
public Receiver() { ID = Guid.NewGuid(); MessageQueue = new List <MessageBase>(); Status = StatusEnum.Connected; InGameProperties = new InGameProperties(); CountDownInGame = new CountDown(); CountDownInGame.CoutDownEv += CountDownInGame_CoutDownEv; MoveAction = new PlayerMoveAction(); MoveAction.ChangeLocationPlayer += MoveAction_ChangeLocationPlayer; }
public virtual BaseStateAction CreateActionClass(Entity owner) { BaseStateAction action = null; switch (actionType) { case ActionType.PlayerMove: action = new PlayerMoveAction(owner, runUpdate); break; case ActionType.PlayerJump: action = new PlayerJumpAction(owner, runUpdate); break; case ActionType.PlayerDash: action = new PlayerDashAction(owner, runUpdate); break; case ActionType.MobWander: action = new WanderAction(owner, runUpdate); break; case ActionType.MobTurnAtLedge: action = new TurnAtLedgeAction(owner, runUpdate); break; case ActionType.MobTurnAtWall: action = new TurnAtWallAction(owner, runUpdate); break; case ActionType.MobFaceTarget: action = new ChaseTargetAction(owner, runUpdate); break; case ActionType.MobMoveNormal: action = new MoveAction(owner, runUpdate); break; default: action = new BaseStateAction(owner, runUpdate); break; } action.PopulateAbilities(abilities); return(action); }
//棋子移動判斷 //originCell : 起點格 / targetCell : 目標格 public void ChessMoveTest(CellBehavior originCell, Vector2 targetPos) { List <CellBehavior> movementCellList = new List <CellBehavior>(); movementCellList = GetMovementPos(originCell); if (movementCellList == null || movementCellList.Count == 0) //無法移動至任何格子時, 直接結束程序 { Debug.Log("無法移動至任何格子"); return; } //for (int i = 0; i < movementCellList.Count; i++) //{ // Debug.Log(string.Format("[ {0} ] : ({1}, {2})", i, movementCellList[i].pos.x, movementCellList[i].pos.y)); //} //若可移動格子List中包含欲移動之位置 bool canMove = false; for (int i = 0; i < movementCellList.Count; i++) { if (movementCellList[i].pos == targetPos) { canMove = true; break; } } bool moveMode = (originCell.cTag == CellTag.打入預備格) ? false : true; if (canMove) { playerMoveAction = new PlayerMoveAction(originCell.chessScript, cellsBoard[(int)targetPos.x, (int)targetPos.y], moveMode); //設定玩家棋子移動命令 } else { Debug.Log("無法移動到指定位置"); } }
public override void UpdateAction() { base.UpdateAction(); if (EntityUtil.StateActionMacro(Owner)) { return; } if (PlayerUtil.GetAttackInput()) { Owner.CurrentAction = PlayerAttackAction.GetInstance(); return; } Vector3 velocity = PlayerUtil.GetVelocityInput(); if (velocity.magnitude > 0.1f) { Owner.CurrentAction = PlayerMoveAction.GetInstance(); return; } }
public override void UpdateAction() { base.UpdateAction(); PlayerUtil.CardInterfaceLogicMacro(); if (EntityUtil.HitDeadLogicMacro(Owner, "PlayerHitAction", "PlayerDeadAction")) { return; } if (PlayerUtil.GetAttackInput()) { Owner.CurrentAction = PlayerAttackAction.GetInstance(); return; } Vector3 velocity = PlayerUtil.GetVelocityInput(); if (velocity.magnitude > 0.1f) { Owner.CurrentAction = PlayerMoveAction.GetInstance(); return; } }