public void OnDetonated(Missile missile) { List <Actor> alist = new List <Actor>(); Actor.GetActorsInRadius(missile.transform.position, missile.explodeRadius, Teams.Allied, TeamOptions.BothTeams, alist); foreach (Actor act in alist) { if (act != missile.actor) { Debug.Log("APassed damage radius checkS"); if (AIDictionaries.reverseAllActors.ContainsKey(act)) { Message_MissileDamage dmgMessage = new Message_MissileDamage(PlayerManager.localUID); dmgMessage.actorTobeDamaged = AIDictionaries.reverseAllActors[act]; dmgMessage.damage = missile.explodeDamage; Debug.Log("sending missile damage"); if (Networker.isHost) { NetworkSenderThread.Instance.SendPacketAsHostToAllClients(dmgMessage, Steamworks.EP2PSend.k_EP2PSendReliable); //NetworkSenderThread.Instance.SendPacketToSpecificPlayer(Networker.hostID, dmgMessage, Steamworks.EP2PSend.k_EP2PSendReliable); } else { NetworkSenderThread.Instance.SendPacketToSpecificPlayer(Networker.hostID, dmgMessage, Steamworks.EP2PSend.k_EP2PSendReliable); } } } } }
public static void MissileDamage(Packet packet) { Message_MissileDamage lastMissileDamageMessage = ((PacketSingle)packet).message as Message_MissileDamage; //ignore damage message from same player //if (lastMissileDamageMessage.networkUID == PlayerManager.localUID) //return; ulong actorTodamage = lastMissileDamageMessage.actorTobeDamaged; Debug.Log("applying missile damage"); if (VTOLVR_Multiplayer.AIDictionaries.allActors.ContainsKey(actorTodamage)) { Actor act = VTOLVR_Multiplayer.AIDictionaries.allActors[actorTodamage]; if (act != null) { act.health.Damage(lastMissileDamageMessage.damage, act.position, Health.DamageTypes.Impact, null); } Debug.Log("applied"); } }