// Note: It is VERY important that the spell # here is the same as the one in the SpellTypes enum (see SpellTypesHelper). // PLEASE MAKE SURE TO MODIFY THEM AT BOTH PLACES. public static SpellTypes GetSpellFromAction(ChampionTypes type, PlayerActionType action) { switch (type) { case ChampionTypes.ManMega: switch (action) { case PlayerActionType.Spell1: return SpellTypes.ManMega_RocketRampage; case PlayerActionType.Spell2: return SpellTypes.ManMega_Slash; case PlayerActionType.Spell3: return SpellTypes.ManMega_HintOfASpark; case PlayerActionType.Spell4: return SpellTypes.ManMega_Shotgun; } break; case ChampionTypes.Zoro: switch (action) { case PlayerActionType.Spell1: return SpellTypes.Zoro_Tooth; case PlayerActionType.Spell2: return SpellTypes.Zoro_Slash; case PlayerActionType.Spell3: return SpellTypes.Zoro_Double; case PlayerActionType.Spell4: return SpellTypes.Zoro_Wall; } break; default: ILogger.Log("Champion type not implemented " + type + "."); break; } return SpellTypes.ManMega_RocketRampage; // Unknown spell: use one by default }
public bool IsCastingSpell(ChampionTypes champ, PlayerActionType action) { SpellTypes spell = ChampionTypesHelper.GetSpellFromAction(champ, action); return(TimeOfLastSpellUse(spell).TotalSeconds + SpellsHelper.Info(spell).CastingTime.TotalSeconds >= Server.Instance.GetTime().TotalSeconds); }
//------------------------------------------------------------------------------------ //calls appropriate animation private void ActionAnimation(PlayerActionType pAT) { switch (pAT) { case PlayerActionType.push: playerController.playerAnimation.ActionAnim("ToPush"); break; case PlayerActionType.charge: playerController.playerAnimation.ActionAnim("ToCharge"); break; case PlayerActionType.pickUp: print("called pickup animation"); playerController.playerAnimation.ActionAnim("ToBoardPickUp"); break; case PlayerActionType.drop: //NA drop animations handled in "PushMe" and "StunMe" functions break; case PlayerActionType.slam: playerController.playerAnimation.ActionAnim("ToSlam"); break; case PlayerActionType.place: playerController.playerAnimation.ActionAnim("ToIdle"); break; default: break; } }
private IEnumerator BoardSlamCoroutine() { //after certain amount of time cast forward to see if player in front of me (because slam animation has to happen) //if that player isn't me //stun them //flatten them //cooldown yield return(new WaitForSeconds(boardSlamDelayForAnim)); //set current PAT currentPAT = PlayerActionType.slam; SeeWhatIsInFrontOfPlayer(boxCastMaxDistanceSlam); if (testCubes) { TestBoxCast(startCube, endCube, boxCastMaxDistanceSlam); } for (int index = 0; index < boxHitInfo.Length; index++) { //if that player isn't me if (boxHitInfo[index].collider.gameObject.GetComponent <PlayerController>() != null && !(boxHitInfo[index].collider.gameObject.Equals(this.gameObject))) { //stun that player PlayerController slammedPlayer = boxHitInfo[index].collider.gameObject.GetComponent <PlayerController>(); slammedPlayer.StunMe(playerForward, slamStunTime); } } }
public PlayerAction(PlayerActionType type, int amount = 0, string svalue = null) { this.type = type; this.amount = amount; this.svalue = svalue; Logic.Action = this; }
private void UpdatePlayerAvailableAction(Vector3 position) { if (_selectedUnit != null) { HexTile tile = PathFinder.Instance.WalkableTileMap.GetHexTile(position); if (tile != null && !tile.Walkable) { UnitBase hooverOverUnit = GameManager.Instance.Units.Where(h => h.Movement.CurrentHexTile == tile).FirstOrDefault(); if (hooverOverUnit != null) { Debug.Log("Test"); } //if (!hooverOverUnit.IsMine) //{ // _playerAction = PlayerActionType.ATTACK; //} } else { _playerAction = PlayerActionType.MOVE; } } else { _playerAction = PlayerActionType.NONE; } }
protected InternalThreat GetFirstThreatOfType(PlayerActionType playerActionType, Player performingPlayer) { return(ThreatController.DamageableInternalThreats .Where(threat => threat.CanBeTargetedBy(StationLocation, playerActionType, performingPlayer)) .OrderBy(threat => threat.TimeAppears) .FirstOrDefault()); }
public PlayerActionResult DoAction(PlayerActionType type, int uid, string pparam = null, int amount = 0, string svalue = null) { Player player; PlayerActionResult result; PlayerAction action = (PlayerAction)Activator.CreateInstance(null, string.Concat("Conquest.Players.Actions.", type.ToString())).Unwrap(); action.Logic = (ActionLogic)Activator.CreateInstance(null, string.Concat("Conquest.Players.Actions.", type.ToString(), "Logic")).Unwrap(); action.Logic.Action = action; action.amount = amount; // Verify executor exists if (!PlayerExists(uid)) { return(new PlayerActionResult(false, ResultType.NotFound)); } else { player = GetPlayer(uid); } if (pparam != null & !PlayerExists(pparam)) { if (!PlayerExists(pparam)) { return(new PlayerActionResult(false, ResultType.NotFound)); } action.playerparam = GetPlayer(pparam); } result = player.DoAction(action); entities.Entry(player).State = System.Data.EntityState.Modified; entities.SaveChanges(); return(result); }
/// <summary> /// Deserializes <see cref="PlayerAction"/> class from stream /// </summary> /// <param name="str">Stream with read possibility, to read <see cref="PlayerAction"/> data from</param> /// <returns>Deserialized <see cref="PlayerAction"/> instance</returns> public static PlayerAction Deserialize(Stream str) { BinaryReader br = new BinaryReader(str); int id = br.ReadInt32(); PlayerActionType actionType = (PlayerActionType)br.ReadInt32(); switch (actionType) { case PlayerActionType.Idle: return(new PlayerAction(actionType, id)); case PlayerActionType.Move: case PlayerActionType.MeleeHit: case PlayerActionType.RangeHit: return(new PlayerActionVectorized(actionType, id, br.ReadInt32(), br.ReadIVector())); case PlayerActionType.BuildStart: return(new PlayerActionBuild(actionType, id, br.ReadInt32(), br.ReadIVector(), br.ReadInt32())); case PlayerActionType.BuildEnd: case PlayerActionType.SelfDestruct: return(new PlayerActionObject(actionType, id, br.ReadInt32())); case PlayerActionType.StartResearch: case PlayerActionType.StartUnitSpawn: return(new PlayerActionOperation(actionType, id, br.ReadInt32(), br.ReadInt32())); case PlayerActionType.StartUnitUpgrade: return(new PlayerActionUpgrade(actionType, id, br.ReadInt32(), br.ReadInt32(), br.ReadInt32())); case PlayerActionType.CancelBuildingAction: return(new PlayerActionCancel(actionType, id, br.ReadInt32(), br.ReadInt32())); } throw new InvalidDataException("Unknown PlayerActionType"); }
public static PlayerActionNode New(string name, PlayerActionType type, Precondition precondition = null) { var node = Node.MakeNode <PlayerActionNode>(name, precondition); node.actionType = type; return(node); }
// Měří čas, kdy by postava měla zaútočit, a po uplynutí prodlevy postava zaútočí private void Attack() { _attackingForSeconds += Time.fixedDeltaTime; if (!_attacked && _attackTime < _attackingForSeconds) { CalculateAttack(); _attacked = true; animator.SetBool("Attack", false); } else if (_attackDuration < _attackingForSeconds) { if (_nextAction != PlayerActionType.Attack) { _attacking = false; _canDoAction = true; _acceptingInput = true; } else { _nextAction = PlayerActionType.None; _attackingForSeconds = 0; _attacked = false; _attacking = true; } } }
PlayerActionType fetchInput() { PlayerActionType result = PlayerActionType.None; if (KeyboardState.IsKeyDown((int)Keys.Left)) { result |= PlayerActionType.RotateLeft; } if (KeyboardState.IsKeyDown((int)Keys.Right)) { result |= PlayerActionType.RotateRight; } if (KeyboardState.IsKeyDown((int)Keys.Up)) { result |= PlayerActionType.MoveFront; } if (KeyboardState.IsKeyDown((int)Keys.Down)) { result |= PlayerActionType.MoveBack; } if (KeyboardState.IsKeyDown((int)Keys.Space)) { soundPlayer.PlaySound("shoot", false); result |= PlayerActionType.Shoot; } if (KeyboardState.IsKeyDown((int)Keys.Escape)) { result |= PlayerActionType.Pause; } return(result); }
/// <summary> /// 转换用户动作到副露类型 /// </summary> /// <param name="playerAction">用户动作</param> /// <returns></returns> private FuruType ActionTypeToFuruType(PlayerActionType playerAction) { switch (playerAction) { case PlayerActionType.ChiGrade: return(FuruType.ChiGrade); case PlayerActionType.ChiSquad: return(FuruType.ChiSquad); case PlayerActionType.Pong: return(FuruType.Pong); case PlayerActionType.Kong: return(FuruType.Kong); case PlayerActionType.Kong_Self: return(FuruType.Kong_Self); case PlayerActionType.Kong_Add: return(FuruType.Kong_Add); default: return(FuruType.Pong); } }
public PlayerAction(PlayerActionType type, System.Action startAction, System.Action stopAction, System.Func <bool> isActionPlaying) { this.type = type; this.startAction = startAction; this.stopAction = stopAction; this.isActionPlaying = isActionPlaying; }
public override bool CanBeTargetedBy(StationLocation stationLocation, PlayerActionType playerActionType, Player performingPlayer) { Check.ArgumentIsNotNull(performingPlayer, "performingPlayer"); return(ActionType == playerActionType && CurrentStations.Contains(performingPlayer.CurrentStation.StationLocation) && performingPlayer != attachedPlayer); }
void ExecuteAction(PlayerActionType type) { switch (type) { case PlayerActionType.MoveLeft: Match.CurrentState.Move(ID, HorizontalDirection.Left); break; case PlayerActionType.MoveRight: Match.CurrentState.Move(ID, HorizontalDirection.Right); break; case PlayerActionType.Jump: Match.CurrentState.Jump(ID); break; case PlayerActionType.Spell1: case PlayerActionType.Spell2: case PlayerActionType.Spell3: case PlayerActionType.Spell4: // no client-side prediction for spells break; default: Debug.Fail(String.Format("Invalid action type \"{0}\"", type)); break; } }
public void UpdateAction(PlayerActionType actionType, bool isFromServerAction = false) { if (this.currentAction != actionType) { this.currentAction = actionType; this.isChangedAction = true; if (this.isLocalPlayer && isFromServerAction == false) { TcpSocket.inst.Request.ActionPlayer(this.playerNum, actionType); } } else { this.isChangedAction = false; } switch (actionType) { case PlayerActionType.Aiming: Aiming(this.isChangedAction); break; case PlayerActionType.Attack: Attack(); break; case PlayerActionType.Damage: Damage(); break; case PlayerActionType.Death: Death(); break; case PlayerActionType.Idle: Stay(); break; case PlayerActionType.Jump: Jump(this.isChangedAction); break; case PlayerActionType.Run: Run(); break; case PlayerActionType.Sitting: Sitting(); break; case PlayerActionType.Walk: Walk(); break; case PlayerActionType.Respawn: Respawn(); break; } }
private void PlayAnimation(PlayerActionType actionType) { if (this.currentActionType != actionType) { this.currentActionType = actionType; this.animationController.UpdateAction(actionType); } }
public PlayerAction(PlayerActionType type, double x, double y, int time, int object1, int object2) { this.type = type; this.x = x; this.y = y; this.time = time; this.object1 = object1; this.object2 = object2; }
public PlayerAction( PlayerActionType type, Card card, Announce announce) { this.Type = type; this.Card = card; this.Announce = announce; }
public PlayerAction(ulong id, PlayerActionType type, float time, Vec2 position, Vec2 target = null) : this() { ID = id; Type = type; Time = time; Position = position; Target = target; }
public PlayerAction(ulong id, PlayerActionType type, float time, Vec2 position, Vec2 target = null) : this() { ID = id; Type = type; Time = time; Position = position; Target = target; }
public PlayerAction( PlayerActionType type, Card card, Announce announce) { this.Type = type; this.Card = card; this.Announce = announce; }
public PlayerAction(PlayerActionType type, double x, double y, int time, int object1, int object2) { this.type = type; this.x = x; this.y = y; this.time = time; this.object1 = object1; this.object2 = object2; }
/// <summary> /// Uses factory method pattern to add an action to the player /// and return the action /// </summary> /// <param name="action">The enum representing the action to /// add</param> /// <returns> /// The action added to the player /// </returns> private PlayerAction AddAction(PlayerActionType action = PlayerActionType.Default) { if (action == PlayerActionType.Default) { this.Action = this.gameObject.AddComponent <DefaultPlayerAction>(); this.Action.Player = this; } return(this.Action); }
/// <summary> /// Packages a client-side action to be sent to the server. This also simulates the action locally /// for client-side prediction. /// </summary> public void PackageAction(PlayerActionType action, Vec2 target) { PlayerAction toPackage = new PlayerAction( IDGenerator.GenerateID(), action, (float)Client.Instance.GetTime().TotalSeconds, Champion.Position, target); Champion.PackageAction(toPackage); }
public void Handle_PlayerAction(PlayerActionType actionType) { switch (actionType) { case PlayerActionType.DashForward: _dashing = true; break; case PlayerActionType.DashForwardEnd: _dashing = false; HitEnemyInFront(); break; default: /*Do nothing*/ break; } }
public static bool IsForBoth(this PlayerActionType type) { switch (type) { case PlayerActionType.GoToAquaWorld: case PlayerActionType.SpendTimeWithFamily: return(true); default: return(false); } }
public static bool IsWorkAction(this PlayerActionType type) { switch (type) { case PlayerActionType.GoToWork: case PlayerActionType.PartnerGoesToWork: return(true); default: return(false); } }
public void SetUpAndExecuteAction(PlayerActionType pAT) { switch (pAT) { case PlayerActionType.push: playerActionDelegate = null; playerActionDelegate += PreAction; playerActionDelegate += PushAction; playerActionDelegate += PostAction; break; case PlayerActionType.charge: playerActionDelegate = null; playerActionDelegate += PreAction; playerActionDelegate += ChargeAction; playerActionDelegate += PostAction; break; case PlayerActionType.pickUp: playerActionDelegate = null; playerActionDelegate += PreAction; playerActionDelegate += PickUpPlankAction; playerActionDelegate += PostAction; break; case PlayerActionType.drop: playerActionDelegate = null; playerActionDelegate += PreAction; playerActionDelegate += DropPlankAction; playerActionDelegate += PostAction; break; case PlayerActionType.slam: playerActionDelegate = null; playerActionDelegate += PreAction; playerActionDelegate += BoardSlamAction; playerActionDelegate += PostAction; break; case PlayerActionType.place: playerActionDelegate = null; playerActionDelegate += PreAction; playerActionDelegate += PlacingPlankAction; playerActionDelegate += PostAction; break; default: break; } ActionAnimation(pAT); playerActionDelegate(); }
// Obdrří vstup a zpracuje ho public void SendInput(PlayerActionType action) { if (_acceptingInput) { _nextAction = action; } else if (_attacking && _attacked && action == PlayerActionType.Attack) { _nextAction = PlayerActionType.Attack; animator.SetBool("Attack", true); } }
static bool IsMovementAction(PlayerActionType action) { switch (action) { case PlayerActionType.MoveLeft: case PlayerActionType.MoveRight: case PlayerActionType.Jump: return(true); default: return(false); } }
protected RTPPlayerAction(CorePlayerActionDefinition CorePlayerActionDefinition) { PlayerActionType = CorePlayerActionDefinition.PlayerActionType; var SelectionWheelNodeConfiguration = SelectionWheelNodeConfigurationGameObject.Get().SelectionWheelNodeConfiguration; SelectionWheelNodeConfigurationData = SelectionWheelNodeConfiguration.ConfigurationInherentData[CorePlayerActionDefinition.ActionWheelNodeConfigurationId]; this.CorePlayerActionDefinition = CorePlayerActionDefinition; //on init, it is available onCooldownTimeElapsed = this.CorePlayerActionDefinition.CoolDownTime * 2; remainingExecutionAmout = this.CorePlayerActionDefinition.ExecutionAmount; }
public void Handle_PlayerAction(PlayerActionType actionType) { switch (actionType) { case PlayerActionType.Jump: PlayRandomSound(JumpSounds); break; case PlayerActionType.DashForward: case PlayerActionType.DashDown: PlayRandomSound(DashSounds); break; } }
private PlayerAction(PlayerActionType type) { this.Type = type; }
public bool IsCastingSpell(ChampionTypes champ, PlayerActionType action) { SpellTypes spell = ChampionTypesHelper.GetSpellFromAction(champ, action); return TimeOfLastSpellUse(spell).TotalSeconds + SpellsHelper.Info(spell).CastingTime.TotalSeconds >= Server.Instance.GetTime().TotalSeconds; }
static bool IsMovementAction(PlayerActionType action) { switch (action) { case PlayerActionType.MoveLeft: case PlayerActionType.MoveRight: case PlayerActionType.Jump: return true; default: return false; } }
public override PlayerAction GetTurn(GetTurnContext context) { if (context.MoneyLeft + context.CurrentPot == 2000) { this.otherAllInsCount++; } // all in protection if (this.otherIsAllInPlayer || this.otherAllInsCount > 9) { this.otherIsAllInPlayer = true; return this.AllInProtection(context); } if (context.PreviousRoundActions.Count > 0 && context.PreviousRoundActions.Last().Action.Type == PlayerActionType.Raise && this.otherLastTurnAction == PlayerActionType.Raise) { this.otherRaiseInRowCount++; } else { this.otherRaiseInRowCount = 0; } if (context.PreviousRoundActions.Count > 0) { this.otherLastTurnAction = context.PreviousRoundActions.Last().Action.Type; } if (this.otherIsAlwaysRaise || this.otherRaiseInRowCount > 20) { this.otherIsAlwaysRaise = true; return this.AlwaysRaiseProtection(context); } // if they raised more than a certain proportion of my money and I don`t have strong hand fold if (context.PreviousRoundActions.Count > 0 && context.PreviousRoundActions.Last().Action.Type == PlayerActionType.Raise) { if (context.MoneyToCall >= context.MoneyLeft / 2 && this.HandStrength < .75) { return PlayerAction.Fold(); } } if (this.HandStrength < .42 && !context.CanCheck) { return PlayerAction.Fold(); } var myMoney = context.MoneyLeft; if (this.HandStrength > .95 && myMoney > 0) { return PlayerAction.Raise(myMoney / 2); } if (this.HandStrength > .75 && myMoney > 0) { return PlayerAction.Raise(myMoney / 4); } return PlayerAction.CheckOrCall(); }
static void UpdateAnimationDataFromAction(ChampionAnimData anim, PlayerActionType action) { switch (action) { case PlayerActionType.Idle: anim.Idle = true; break; case PlayerActionType.MoveLeft: --anim.Movement; break; case PlayerActionType.MoveRight: ++anim.Movement; break; default: break; } }
void ExecuteAction(PlayerActionType type) { switch (type) { case PlayerActionType.MoveLeft: Match.CurrentState.Move(ID, HorizontalDirection.Left); break; case PlayerActionType.MoveRight: Match.CurrentState.Move(ID, HorizontalDirection.Right); break; case PlayerActionType.Jump: Match.CurrentState.Jump(ID); break; case PlayerActionType.Spell1: case PlayerActionType.Spell2: case PlayerActionType.Spell3: case PlayerActionType.Spell4: // no client-side prediction for spells break; default: Debug.Fail(String.Format("Invalid action type \"{0}\"", type)); break; } }
public static bool IsSpell(PlayerActionType a) { return PlayerActionType.Spell1 <= a && a <= PlayerActionType.Spell4; }
private SimPlayerAction(PlayerActionType type, Card card) { this.Type = type; this.Card = card; this.Announce = Announce.None; }
public ValidPlayer(PlayerActionType actionToPlay = PlayerActionType.PlayCard) { this.actionToPlay = actionToPlay; }
public override PlayerAction GetTurn(PlayerTurnContext context) { this.GetTurnCalledCount++; this.GetTurnContextObject = context.DeepClone(); if (this.actionToPlay == PlayerActionType.ChangeTrump) { this.actionToPlay = PlayerActionType.PlayCard; return this.ChangeTrump(context.TrumpCard); } if (this.actionToPlay == PlayerActionType.CloseGame) { this.actionToPlay = PlayerActionType.PlayCard; return PlayerAction.CloseGame(); } var possibleCardsToPlay = this.PlayerActionValidator.GetPossibleCardsToPlay(context, this.Cards); return this.PlayCard(possibleCardsToPlay.First()); }