private void Awake() { lastMessage = new Message_Death(networkUID, false, "empty"); Networker.Death += Death; health = GetComponent <Health>(); health.invincible = true; }
public void Death(Packet packet) { lastMessage = (Message_Death)((PacketSingle)packet).message; if (lastMessage.UID != networkUID) { return; } // int player = PlayerManager.GetPlayerIDFromCSteamID(new Steamworks.CSteamID(PlayerManager.localUID)); string name = Steamworks.SteamFriends.GetPersonaName(); if (lastMessage.message.Contains(name)) { PlayerManager.kills++; FlightLogger.Log("You got " + PlayerManager.kills + " Kill(s)"); } FlightLogger.Log(lastMessage.message); if (lastMessage.immediate) { Destroy(gameObject); } else { health.invincible = false; health.Kill(); } }
public void Death(Packet packet) { lastMessage = (Message_Death)((PacketSingle)packet).message; if (lastMessage.UID != networkUID) { return; } Actor actor = GetComponent <Actor>(); if (actor == null) { Debug.Log("actor was null"); } else { if (actor.unitSpawn != null) { if (actor.unitSpawn.unitSpawner == null) { Debug.Log("unit spawner was null, adding one"); actor.unitSpawn.unitSpawner = actor.gameObject.AddComponent <UnitSpawner>(); } } } health.invincible = false; health.Kill(); }
private void Awake() { lastMessage = new Message_Death(networkUID, false); Networker.Death += Death; Networker.BulletHit += this.BulletHit; health = GetComponent <Health>(); //health.invincible = true; }
private void Awake() { lastMessage = new Message_Death(networkUID, false); health = GetComponent <Health>(); if (health == null) { Debug.LogError("health was null on vehicle " + gameObject.name); } else { health.OnDeath.AddListener(Death); } Debug.LogError("found health on " + gameObject.name); Networker.BulletHit += this.BulletHit; }
public void Death(Packet packet) { lastMessage = (Message_Death)((PacketSingle)packet).message; if (lastMessage.UID != networkUID) { return; } if (lastMessage.immediate) { Destroy(gameObject); } else { health.invincible = false; health.Kill(); } }
private void Awake() { lastMessage = new Message_Death(networkUID, false, "empty"); ownerActor = GetComponentInParent <Actor>(); health = ownerActor.health; if (health == null) { Debug.LogError("health was null on vehicle " + gameObject.name); } else { health.OnDeath.AddListener(Death); } Debug.LogError("found health on " + gameObject.name); ownerActor.hideDeathLog = true; Networker.BulletHit += this.BulletHit; }
private void Awake() { actor = gameObject.GetComponent <Actor>(); lastFiringMessage = new Message_WeaponFiring(-1, false, false, networkUID); // lastStoppedFiringMessage = new Message_WeaponStoppedFiring(networkUID); lastCountermeasureMessage = new Message_FireCountermeasure(true, true, networkUID); lastDeathMessage = new Message_Death(networkUID, false); wheelsController = GetComponent <WheelsController>(); aeroController = GetComponent <AeroController>(); isPlayer = actor.isPlayer; sequenceNumber = 0; lastMessage = new Message_PlaneUpdate(false, 0, 0, 0, 0, 0, 0, false, false, false, networkUID, sequenceNumber); engine = gameObject.GetComponentInChildren <ModuleEngine>(); if (engine == null) { Debug.Log("engine was null on vehicle " + gameObject.name); } weaponManager = GetComponent <WeaponManager>(); if (weaponManager == null) { Debug.LogError("Weapon Manager was null on vehicle " + gameObject.name); } else { traverse = Traverse.Create(weaponManager); Networker.WeaponSet += WeaponSet; //weaponManager.OnWeaponEquipped += Rearm; //weaponManager.OnWeaponUnequippedHPIdx +=Rearm; //detect player rearm PlayerVehicleSetup pv = gameObject.GetComponent <PlayerVehicleSetup>(); if (pv != null) { pv.OnEndRearming.AddListener(Rearm); } if (actor.isPlayer && weaponManager.GetIWBForEquip(3) != null) { iwb = weaponManager.GetIWBForEquip(3); } } cmManager = GetComponentInChildren <CountermeasureManager>(); if (cmManager == null) { Debug.LogError("CountermeasureManager was null on vehicle " + gameObject.name); } else { cmManager.OnFiredCM += FireCountermeasure; } fuelTank = GetComponent <FuelTank>(); if (fuelTank == null) { Debug.LogError("FuelTank was null on vehicle " + gameObject.name); } Debug.Log("Done Plane Sender"); tailhook = GetComponentInChildren <Tailhook>(); launchBar = GetComponentInChildren <CatapultHook>(); refuelPort = GetComponentInChildren <RefuelPort>(); }