// TODO - How to handle ties with the speed values (players have priority?) /// <summary> /// Iterates through all of the CombatPawns in the combat, and checks to see which has the highest speed that /// has not taken its move yet. Sets the result as the current combat pawn to call OnAction /// </summary> public void GetNextCombatPawn() { PhotonView sceneView = GetComponent<PhotonView>(); // If the combat has been completed (one side completely defeated, then exit the state) if (_isCombatComplete()) { Debug.Log("Combat is complete"); m_isClientReady = true; sceneView.RPC("IncrementPlayersReady", PhotonTargets.All); m_isTurnComplete = true; return; } // Handle any pawns that have been defeated by the previous move's effect _checkForDefeatedPawns(); float currentHighestSpeed = 0; CombatPawn fastestCombatPawn = null; // Iterate through all of the CombatPawn in the CombatManager foreach (CombatPawn combatPawn in CManager.PawnToMove.Keys) { float currentSpeed = combatPawn.Speed; // If the speed of the current pawn is higher than the current highest speed and the current pawn has not executed // its move for the turn, set the fasted combat pawn to this combat pawn if (currentSpeed > currentHighestSpeed && !combatPawn.IsActionComplete) { currentHighestSpeed = currentSpeed; fastestCombatPawn = combatPawn; } } // If the fastest combat pawn is not null, set the current combat pawn to this if (fastestCombatPawn != null) { m_currentCombatPawn = fastestCombatPawn; // Need to initialize the move in case the same move has been used this turn since it resets the booleans CombatMove pawnMove = CManager.PawnToMove[m_currentCombatPawn]; pawnMove.InitializeMove(); } // Otherwise, all the combat pawns have done their move, so exit the execute state else { Debug.Log("Combat is complete"); sceneView.RPC("IncrementPlayersReady", PhotonTargets.All); m_isClientReady = true; m_isTurnComplete = true; } }
/// <summary> /// Removes the given target from the target list if it is in the target list /// </summary> /// <param name="targetToRemove">The CombatPawn to remove from the list of targets</param> public void RemoveTarget(CombatPawn targetToRemove) { if (m_targets.Contains(targetToRemove)) { m_targets.Remove(targetToRemove); } }
public void SetMoveOwner(CombatPawn moveOwner) { m_moveOwner = moveOwner; }
public override void RemovePawnFromTeam(CombatPawn pawnToRemove) { base.RemovePawnFromTeam(pawnToRemove); }
public void ScalePawnByLevel(CombatPawn pawnToScale, int roomLevel) { // Increase HP based on level int hpIncrease = m_hpIncreasePerLevel * roomLevel; int newMax = hpIncrease + (int)pawnToScale.MaxHealth; pawnToScale.SetMaxHealth(newMax); pawnToScale.Health = newMax; // Increase attack based on level int attackIncrease = m_attackIncreasePerLevel * roomLevel; int newAttack = attackIncrease + (int)pawnToScale.Attack; pawnToScale.Attack = newAttack; // Increase defense based on level int defenseIncrease = m_defenseIncreasePerLevel * roomLevel; int newDefense = defenseIncrease + (int)pawnToScale.Defense; pawnToScale.Defense = newDefense; // Increase speed based on level int speedIncrease = m_speedIncreasePerLevel * roomLevel; int newSpeed = speedIncrease + (int)pawnToScale.Speed; pawnToScale.Speed = newSpeed; }
private void _disablePawnMesh(CombatPawn pawnToDisable) { pawnToDisable.GetComponent<Animator>().enabled = false; pawnToDisable.GetComponentInChildren<SkinnedMeshRenderer>().enabled = false; MeshRenderer[] allMeshRenderers = pawnToDisable.GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer m in allMeshRenderers) { m.enabled = false; } }
/// <summary> /// Removes the pawn from the PawnsOnTeam list /// </summary> /// <param name="pawnToRemove">The pawn to remove from the list</param> public virtual void RemovePawnFromTeam(CombatPawn pawnToRemove) { m_activePawnsOnTeam.Remove(pawnToRemove); }
/// <summary> /// Adds a pawn to the list of pawns that will be spawned when the team is initialized /// </summary> /// <param name="pawnToSpawn">The pawn to add to the list</param> public void AddPawnToSpawn(CombatPawn pawnToSpawn) { m_pawnsToSpawn.Add(pawnToSpawn); }
/// <summary> /// Adds a pawn to the on team list /// </summary> /// <param name="pawnToAdd">The pawn to add to the list of pawns on the team</param> public void AddPawnToTeam(CombatPawn pawnToAdd) { m_activePawnsOnTeam.Add(pawnToAdd); }
/// <summary> /// Adds a pawn to the list of pawns that have been spawned by this team /// </summary> /// <param name="pawnSpawned">The pawn that has been spawned</param> protected void AddPawnToSpawned(CombatPawn pawnSpawned) { m_allPawnsSpawned.Add(pawnSpawned); }