/// <summary> /// Heals the damage inflictor if leech is active and attck is allied with leech inflictor. /// </summary> /// <param name="dmgInflicterArg"></param> /// <param name="dmgArg"></param> private void ApplyDamageLeechHealingIfAppropriate(CharacterMasterController dmgInflicterArg, int dmgArg) { // if given damage is ast least one AND some damage leech healing is active if (dmgArg > 0 && damageHealingLeechPercentage > 0f) { // if no health leech inflictor is setup if (damageHealingLeechInflicterFactionRep == null) { // print warning to console Debug.LogWarning("No health leech inflictor was setup!"); // DONT continue code return; } // get char data for surface level properties from the char master CharacterData charFrontFacingData = GeneralMethods.GetFrontFacingCharacterDataFromCharMaster( dmgInflicterArg); // if attacker is allied with the leech effect inflictor if (charFrontFacingData.factionReputation.AreFactionAllies(damageHealingLeechInflicterFactionRep)) { // heal the attacker by percentage of the damage done dmgInflicterArg.CharHealth.HealHealth(dmgInflicterArg, GetDamageHealingLeechValue(dmgArg)); } } }
public override void OnInteractionTargetingEnd(CharacterMasterController interactorArg) { base.OnInteractionTargetingEnd(interactorArg); // turn OFF weapon preview if it's setup _itemPickup.SetWeaponPreviewActivation(false); }
public override void SetupActiveAbility(ActiveAbility castedActiveAbilityArg, CharacterMasterController casterCharacterArg, CharacterData casterCharacterDataArg) { base.SetupActiveAbility(castedActiveAbilityArg, casterCharacterArg, casterCharacterDataArg); SetupAbilitySize(); }
public override void SetupActiveAbility(ActiveAbility castedActiveAbilityArg, CharacterMasterController casterCharacterArg, CharacterData casterCharacterDataArg) { base.SetupActiveAbility(castedActiveAbilityArg, casterCharacterArg, casterCharacterDataArg); // setup ability projectile properties SetupAbilityTargetPenetrationMax(); }
public override void SetupProjectile(CharacterMasterController charArg) { base.SetupProjectile(charArg); firingWeapon = charArg.GetEquippedWeapon(); projectileSpeed = firingWeapon.weaponStats.projectileSpeed; }
public override void OnLocalPlayerEnterProximity(CharacterMasterController interactorArg) { base.OnLocalPlayerEnterProximity(interactorArg); if (_itemPickup.IsAutomaticPickup) { _itemPickup.Pickup(interactorArg); } }
public override void SetupActiveAbility(ActiveAbility castedActiveAbilityArg, CharacterMasterController casterCharacterArg, CharacterData casterCharacterDataArg) { base.SetupActiveAbility(castedActiveAbilityArg, casterCharacterArg, casterCharacterDataArg); SetupAbilitySize(); SetupAbilityMovementDecreasePercentageAndStatusEffect(); SetupAbilityEffectDuration(); }
/// <summary> /// Spawns and sets up the action text popup, if appropriate to do so. /// </summary> /// <param name="changeInflicterArg"></param> /// <param name="isIncreasingArg"></param> /// <param name="changeValueArg"></param> private void SetupActionTextPopupIfAppropriate(CharacterMasterController changeInflicterArg, bool isIncreasingArg, int changeValueArg, Vector3 spawnPointArg) { // if NO inflicter if (changeInflicterArg == null) { // DONT continue code return; } // if inflicter is NOT a player if ((changeInflicterArg as PlayerCharacterMasterController) == null) { // DONT continue code return; } // if inflicter is online but NOT associated with the machine running this if (GeneralMethods.IsNetworkConnectedButNotLocalClient(changeInflicterArg.netIdentity)) { // DONT continue code return; } // if self-infliction if (_characterMasterController == changeInflicterArg) { // DONT continue return; } // spawn an action text popup ActionTextPopupController spawnedPopup = SpawnActionTextPopup(spawnPointArg); // if adding health if (isIncreasingArg) { // setup action text popup to denote healing spawnedPopup.Setup("+", Color.green); } // else removing health else { // initialize damage popup color Color damagePopupColor = GetTemporaryDamagePopupColorsMix(); // if no actual damage was taken if (changeValueArg <= 0) { damagePopupColor = Color.grey; } // setup action text popup to denote healing spawnedPopup.Setup(changeValueArg.ToString(), damagePopupColor); } }
public override void SetupActiveAbility(ActiveAbility castedActiveAbilityArg, CharacterMasterController casterCharacterArg, CharacterData casterCharacterDataArg) { base.SetupActiveAbility(castedActiveAbilityArg, casterCharacterArg, casterCharacterDataArg); // setup ability proeprties SetupAbilityDamageHealingPercentage(); SetupAbilityEffectDuration(); // setup the actual status effect ability data SetupAbilityStatusEffect(damageHealingPercentage); }
/// <summary> /// Denotes that given spawned enemy is dead. /// </summary> /// <param name="charMasterArg"></param> private void RemoveEnemyFromAliveSpawns(CharacterMasterController charMasterArg) { // if given spawn character still considered alive if (aliveSpawnedCharacters.Contains(charMasterArg)) { // denote spawn char is dead aliveSpawnedCharacters.Remove(charMasterArg); } // setup the arena exit based on current arena conditions RefreshArenaExitStatus(); }
public override void SetupActiveAbility(ActiveAbility castedActiveAbilityArg, CharacterMasterController casterCharacterArg, CharacterData casterCharacterDataArg) { base.SetupActiveAbility(castedActiveAbilityArg, casterCharacterArg, casterCharacterDataArg); // setup ability proeprties SetupAbilityDamageTakenIncreasePercentage(); SetupAbilityEffectDuration(); SetupAbilityTargetPenetration(); // fires off the appropriate amount of weakening projectiles FireWeakeningProjectiles(); }
public void Pickup(CharacterMasterController pickerArg) { if (NetworkClient.isConnected) { CmdPickup(); } else { PickupMain(); } // unspawn object GetComponent<NetworkPooledObjectController>().UnspawnObject(); }
public virtual void SetupActiveAbility(ActiveAbility castedActiveAbilityArg, CharacterMasterController casterCharacterArg, CharacterData casterCharacterDataArg) { _castedAbility = castedActiveAbilityArg; _casterCharMaster = casterCharacterArg; _casterCharData = casterCharacterDataArg; _castPoint = casterCharacterArg.CharSight.FirePoint; // setup the ability rank to the rank calcualted based on the casted ability and the caster SetupAppropriateAbilityRank(); // setup how long the object will be active for SetupObjectLifetime(); }
/// <summary> /// Sets the character that the AI brain is currently targeting. /// </summary> /// <param name="charToTargetArg"></param> private void SetBrainTarget(CharacterMasterController charToTargetArg) { //i f given valid existing character if (charToTargetArg != null) { // set brain target to given char's trans _aiBrain.Target = charToTargetArg.transform; } // else given invalid non-existing character else { // set brain target to a NULL trans _aiBrain.Target = null; } }
public override bool Decide() { // get the char with highest threat points CharacterMasterController mostThreateningChar = GetMostThreateningCharacter(); // if threatening target found AND that character to target was not previously being targeted (i.e. is a new target) if ((mostThreateningChar != null) && (mostThreateningChar.transform != _aiBrain.Target)) { Debug.Log("NEED IMPL: Play aggro sound effect"); // NEED IMPL!!! } // set the AI brain's target to the highest threat char's object SetBrainTarget(mostThreateningChar); // return bool denoting whether a threatening char was found return(mostThreateningChar != null); }
/// <summary> /// Adds the given objects to the relevant spawn lists. /// </summary> /// <param name="spawnedObjArg"></param> private void AddObjectToSpawnsList(NetworkPooledObjectController spawnedObjArg) { // add spawned object to spawned list for easy cleanup later spawnedObjects.Add(spawnedObjArg); // get the given spawned object's character component CharacterMasterController spawnCharMaster = spawnedObjArg.GetComponent <CharacterMasterController>(); // if given object is a character if (spawnCharMaster != null) { // heal char to full health spawnCharMaster.CharHealth.ResetHealth(); // add enemy to alive spawn chars aliveSpawnedCharacters.Add(spawnCharMaster); } }
/// <summary> /// Executes the local player proximity method based on given details. /// </summary> /// <param name="colliderArg"></param> /// <param name="isEnteringProximityArg"></param> private void CallLocalPlayerProximityMethodIfAppropriate(Collider colliderArg, bool isEnteringProximityArg) { // get net identity comp from given object NetworkIdentity _networkIdentity = colliderArg.GetComponent <NetworkIdentity>(); /// if NO net identity comp found OR player is online but NOT associated with /// the machine running this if (_networkIdentity == null || GeneralMethods. IsNetworkConnectedButNotLocalClient(_networkIdentity)) { // DONT continue code return; } // get char master comp from given object CharacterMasterController _charMaster = colliderArg.GetComponent <CharacterMasterController>(); // if no char master comp found if (_charMaster == null) { // print warning to console Debug.LogWarning("Player entering interactable proximity does not have CharacterMasterController! " + $"Object name: {colliderArg.name}"); // DONT continue code return; } // if ENTERING the proximity if (isEnteringProximityArg) { // call ENTER proximity method OnLocalPlayerEnterProximity(_charMaster); } // else EXITING the proximity else { // call EXIT proximity method OnLocalPlayerExitProximity(_charMaster); } }
/// <summary> /// Adds threat points to the given character's asscoiated threat. /// </summary> /// <param name="threateningCharArg"></param> /// <param name="threatPointsArg"></param> public void AddThreat(CharacterMasterController threateningCharArg, int threatPointsArg) { // if the given threatenting character is NULL if (threateningCharArg == null) { //DONT continue code return; } // if the threat system DOES have the given character already as a threat if (characterToThreatPoints.ContainsKey(threateningCharArg)) { // add the given threat points to the character's exisitng threat points characterToThreatPoints[threateningCharArg] += threatPointsArg; } // else the threat system does NOT have the given character already as a threat else { // add the character to the threat system starting them with the given threat points characterToThreatPoints[threateningCharArg] = threatPointsArg; } }
/// <summary> /// Call when this interactable STOPS being targeted by an interactor /// for a potential interaction. /// </summary> public virtual void OnInteractionTargetingEnd(CharacterMasterController interactorArg) { // IMPL in child class }
public virtual void Interact(CharacterMasterController interactorArg) { // IMPL in child class }
/// <summary> /// When the player who is associated with the machine running this /// game instance moves away from this interactable. /// </summary> public virtual void OnLocalPlayerExitProximity(CharacterMasterController interactorArg) { // IMPL in child class }
public override void Interact(CharacterMasterController interactorArg) { base.Interact(interactorArg); _itemPickup.Pickup(interactorArg); }
/// <summary> /// Makes manager aware of a threat but do not increase the actual threat they pose. /// </summary> public void MakeAwareOfThreat(CharacterMasterController threateningCharArg) { AddThreat(threateningCharArg, 0); }
public static void Trigger(CharacterMasterController charMasterArg) { e.charMaster = charMasterArg; MMEventManager.TriggerEvent(e); }
/// <summary> /// Have the character take damage to their health. /// </summary> /// <param name="damageInflicterArg"></param> /// <param name="damageArg"></param> public void TakeDamage(CharacterMasterController damageInflicterArg, int damageArg, Vector3 impactPointArg) { ChangeHealthValue(damageInflicterArg, false, damageArg, impactPointArg); }
/// <summary> /// Changes the character's health value based on given properties. /// </summary> /// <param name="changeInflicterArg"></param> /// <param name="isIncreasingArg"></param> /// <param name="changeValueArg"></param> /// <param name="impactPointArg"></param> private void ChangeHealthValue(CharacterMasterController changeInflicterArg, bool isIncreasingArg, int changeValueArg, Vector3 impactPointArg) { // if taking damage AND in post-damage invincibility if (!isIncreasingArg && inPostDamageInvincibility) { // DONT continue code return; } // get char data for surface level properties from the char master CharacterData charFrontFacingData = GeneralMethods.GetFrontFacingCharacterDataFromCharMaster( _characterMasterController); // initialize var to hold the actual change value, true value based on char stats int actualChangeValue = changeValueArg; // if taking damage if (!isIncreasingArg) { // get the damage change when damage taken change is taken into account float dmgChangeAmountUnrounded = changeValueArg * damageTakenChangePercentage; // round the damage change value int dmgChangeAmount = Mathf.RoundToInt(dmgChangeAmountUnrounded); /// add the damage change to the current actual change value, while ensuring the damage /// does not fall below zero. /// NOTE: a negative change should decrease damage taken and positive will increase actualChangeValue = Mathf.Max(actualChangeValue + dmgChangeAmount, 0); } // if adding health if (isIncreasingArg) { // have the surface level char recover health charFrontFacingData.characterStats.HealHealth(changeValueArg); // call health healed actions if NOT null OnHealthHealed?.Invoke(); } // else removing health else { // have the surface level char take health damage actualChangeValue = charFrontFacingData.characterStats.TakeDamage(changeValueArg); // heals the damage inflictor if leech is active and attck is allied with leech inflictor ApplyDamageLeechHealingIfAppropriate(changeInflicterArg, changeValueArg); // call damage taken actions if NOT null OnDamageTaken?.Invoke(); } /// get the char's post-damage invincibility time. /// NOTE: this code stuff done here because healing should also give char a short invincibility float dmgInvincTime = charFrontFacingData.characterStats.postDamageInvincibilityTime; // if char has post-damage invincibility if (dmgInvincTime > 0f) { // make char unable to take damage for given time ApplyPostDamageInvincibility(dmgInvincTime); } // spawns and sets up the action text popup, if appropriate to do so SetupActionTextPopupIfAppropriate(changeInflicterArg, isIncreasingArg, actualChangeValue, impactPointArg); /// set all the swap characters health based on the surface level char's health percentage, /// if appropriate to do so MatchHealthPercentageForSwapCharactersIfAppropriate(charFrontFacingData); // call health change actions if NOT null OnHealthChangedAction?.Invoke(); // if character has run out of health if (charFrontFacingData.characterStats.IsOutOfHealth()) { // performs the necessary operations when the character loses all their health ProcessDeath(); } }
public void HealHealth(CharacterMasterController healingInflicterArg, int healingArg) { HealHealth(healingInflicterArg, healingArg, defaultActionTextPopupPointArg.position); }
public void TakeDamage(CharacterMasterController damageInflicterArg, int damageArg) { TakeDamage(damageInflicterArg, damageArg, defaultActionTextPopupPointArg.position); }
/// <summary> /// Have the character recover health. /// </summary> /// <param name="healingInflicterArg"></param> /// <param name="healingArg"></param> public void HealHealth(CharacterMasterController healingInflicterArg, int healingArg, Vector3 impactPointArg) { ChangeHealthValue(healingInflicterArg, true, healingArg, impactPointArg); }
/// <summary> /// Initializes a new instance of the struct. /// </summary> /// <param name="charMasterArg"></param> public SpawnedCharacterDeathEvent(CharacterMasterController charMasterArg) { charMaster = charMasterArg; }