string UpdateServer_MOVING() { // events sorted by priority (e.g. target doesn't matter if we died) if (EventOwnerDisappeared()) { // owner might disconnect or get destroyed for some reason NetworkServer.Destroy(gameObject); return("IDLE"); } if (EventDied()) { // we died. OnDeath(); currentSkill = -1; // in case we died while trying to cast agent.ResetPath(); return("DEAD"); } if (EventMoveEnd()) { // we reached our destination. return("IDLE"); } if (EventTargetDied()) { // we had a target before, but it died now. clear it. target = null; currentSkill = -1; agent.ResetPath(); return("IDLE"); } if (EventNeedTeleportToOwner()) { agent.Warp(owner.petDestination); return("IDLE"); } if (EventTargetTooFarToFollow()) { // we had a target before, but it's out of follow range now. // clear it and go back to start. don't stay here. target = null; currentSkill = -1; agent.stoppingDistance = 0; agent.destination = owner.petDestination; return("MOVING"); } if (EventTargetTooFarToAttack()) { // we had a target before, but it's out of attack range now. // follow it. (use collider point(s) to also work with big entities) agent.stoppingDistance = CurrentCastRange() * 0.8f; agent.destination = target.collider.ClosestPointOnBounds(transform.position); return("MOVING"); } if (EventAggro()) { // target in attack range. try to cast a first skill on it // (we may get a target while randomly wandering around) if (skills.Count > 0) { currentSkill = NextSkill(); } else { Debug.LogError(name + " has no skills to attack with."); } agent.ResetPath(); return("IDLE"); } if (EventNeedReturnToOwner()) { } // don't care if (EventDeathTimeElapsed()) { } // don't care if (EventSkillFinished()) { } // don't care if (EventTargetDisappeared()) { } // don't care if (EventSkillRequest()) { } // don't care, finish movement first return("MOVING"); // nothing interesting happened }
void Cmdkill() { Destroy(this.gameObject); NetworkServer.Destroy(this.gameObject); }
public void Despawn() { NetworkServer.Destroy(gameObject); }
private void DestroySelf() { NetworkServer.Destroy(gameObject); }
private void Kill() { // Destroy the projectile for all clients NetworkServer.Destroy(gameObject); }
//Destroying Projectile private void DestroyProjectile() { NetworkServer.Destroy(gameObject); }
void DestroyMe() { NetworkServer.Destroy(gameObject); }
public void Deplete() { NetworkServer.Destroy(gameObject); }
void CmdPleaseDestroyThisThing(GameObject thing) { NetworkServer.UnSpawn(thing); NetworkServer.Destroy(thing); }
void OnTriggerEnter(Collider co) { NetworkServer.Destroy(gameObject); }
private IEnumerator DestroyNetworkObject(GameObject GO, float delay) { yield return(new WaitForSeconds(delay)); NetworkServer.Destroy(GO); }
void OnTriggerEnter(Collider other) { NetworkServer.Destroy(gameObject); NetworkServer.Destroy(other.gameObject); }
string UpdateServer_DEAD() { // events sorted by priority (e.g. target doesn't matter if we died) if (EventRespawnTimeElapsed()) { // respawn at the start position with full health, visibility, no loot Money = 0; inventory.Clear(); Show(); agent.Warp(startPosition); // recommended over transform.position Revive(); return("IDLE"); } if (EventDeathTimeElapsed()) { // we were lying around dead for long enough now. // hide while respawning, or disappear forever if (respawn) { Hide(); } else { NetworkServer.Destroy(gameObject); } return("DEAD"); } if (EventSkillRequest()) { } // don't care if (EventSkillFinished()) { } // don't care if (EventMoveEnd()) { } // don't care if (EventTargetDisappeared()) { } // don't care if (EventTargetDied()) { } // don't care if (EventTargetTooFarToFollow()) { } // don't care if (EventTargetTooFarToAttack()) { } // don't care if (EventTargetEnteredSafeZone()) { } // don't care if (EventAggro()) { } // don't care if (EventMoveRandomly()) { } // don't care if (EventStunned()) { } // don't care if (EventDied()) { } // don't care, of course we are dead return("DEAD"); // nothing interesting happened }
string UpdateServer_CASTING() { // keep looking at the target for server & clients (only Y rotation) if (target) { LookAtY(target.transform.position); } // events sorted by priority (e.g. target doesn't matter if we died) if (EventOwnerDisappeared()) { // owner might disconnect or get destroyed for some reason NetworkServer.Destroy(gameObject); return("IDLE"); } if (EventDied()) { // we died. OnDeath(); currentSkill = -1; // in case we died while trying to cast return("DEAD"); } if (EventTargetDisappeared()) { // cancel if the target matters for this skill if (skills[currentSkill].cancelCastIfTargetDied) { currentSkill = -1; target = null; return("IDLE"); } } if (EventTargetDied()) { // cancel if the target matters for this skill if (skills[currentSkill].cancelCastIfTargetDied) { currentSkill = -1; target = null; return("IDLE"); } } if (EventSkillFinished()) { // finished casting. apply the skill on the target. CastSkill(skills[currentSkill]); // did the target die? then clear it so that the monster doesn't // run towards it if the target respawned if (target.health == 0) { target = null; } // go back to IDLE lastSkill = currentSkill; currentSkill = -1; return("IDLE"); } if (EventMoveEnd()) { } // don't care if (EventDeathTimeElapsed()) { } // don't care if (EventNeedTeleportToOwner()) { } // don't care if (EventNeedReturnToOwner()) { } // don't care if (EventTargetTooFarToAttack()) { } // don't care, we were close enough when starting to cast if (EventTargetTooFarToFollow()) { } // don't care, we were close enough when starting to cast if (EventAggro()) { } // don't care, always have aggro while casting if (EventSkillRequest()) { } // don't care, that's why we are here return("CASTING"); // nothing interesting happened }
private void CmdDespawn(uint netID) { GameObject gm = NetworkIdentity.spawned[netID].gameObject; NetworkServer.Destroy(gm); }
IEnumerator DestroyAfter() { yield return(new WaitForSeconds(timeBeforeDestruction)); NetworkServer.Destroy(gameObject); }
void CmdDie(GameObject bbb) { Destroy(bbb.gameObject); NetworkServer.Destroy(bbb.gameObject); }
private IEnumerable <float> Tranquilize(Player p) { GameObject target = (GameObject)p.GetGameObject(); Vector loc = p.GetPosition(); // -- Make them ghostmoded if enabled if (TranqGunPlugin.Ghostmode) { p.SetGhostMode(true, true, false); } else { p.SetGodmode(true); } // -- Spawn ragdoll int role = (int)p.TeamRole.Role; Class c = PlayerManager.localPlayer.GetComponent <CharacterClassManager>().klasy[role]; GameObject ragdoll = Object.Instantiate( c.model_ragdoll, target.transform.position + c.ragdoll_offset.position, Quaternion.Euler(target.transform.rotation.eulerAngles + c.ragdoll_offset.rotation) ); NetworkServer.Spawn(ragdoll); ragdoll.GetComponent <Ragdoll>().SetOwner(new Ragdoll.Info(p.PlayerId.ToString(), p.Name, new PlayerStats.HitInfo(), role, p.PlayerId)); if (TranqGunPlugin.DropItems) { if (TranqGunPlugin.DropHeld) { p.GetCurrentItem().Drop(); } else { foreach (Smod2.API.Item item in p.GetInventory()) { item.Drop(); } } } // -- Freeze them until duration is up (teleport if !ghostmode) float elapsed = 0; while (elapsed < TranqGunPlugin.TranqDuration) { elapsed += Time.deltaTime; p.Teleport(TranqGunPlugin.Ghostmode ? loc : Vector.Zero); p.SetCurrentItemIndex(-1); // disallow equipping anything yield return(0); } p.Teleport(loc); p.SetGodmode(false); // -- Remove ghostmode and ragdoll p.SetGhostMode(false); NetworkServer.Destroy(ragdoll); }
private void Remove() { NetworkServer.Destroy(gameObject); }
private IEnumerator WaitToDestroy() { yield return(new WaitForSeconds(5f)); NetworkServer.Destroy(gameObject); }
void CmdDestroyNow() { NetworkServer.Destroy(this.gameObject); }
public void CmdDestroy(GameObject obj) { NetworkServer.Destroy(obj); }
void CmdDestroyObject(GameObject obj) { //if (!obj) return; NetworkServer.Destroy(obj); }
void CmdDestroyCrown() { NetworkServer.Destroy(GameObject.FindGameObjectWithTag("holy_grail")); Debug.Log("Holy grail has been destroyed!!!!!"); }
private void ServerHandleDie() { NetworkServer.Destroy(gameObject); }
void OnDeath() { // disappear forever NetworkServer.Destroy(gameObject); }
//*********************************************************************************************************************************************************************************** // CoRoutine that kills the bomb off one second after the routine is called //*********************************************************************************************************************************************************************************** public IEnumerator deleteSelf() { yield return(new WaitForSeconds(1)); NetworkServer.Destroy(gameObject); }
void OnDead() { NetworkServer.Destroy(this.gameObject); }
public void CmdCollectSegment(GameObject segment) { segmentCount--; NetworkServer.Destroy(segment); }
string UpdateServer_IDLE() { // events sorted by priority (e.g. target doesn't matter if we died) if (EventOwnerDisappeared()) { // owner might disconnect or get destroyed for some reason NetworkServer.Destroy(gameObject); return("IDLE"); } if (EventDied()) { // we died. OnDeath(); currentSkill = -1; // in case we died while trying to cast return("DEAD"); } if (EventTargetDied()) { // we had a target before, but it died now. clear it. target = null; currentSkill = -1; return("IDLE"); } if (EventNeedTeleportToOwner()) { agent.Warp(owner.petDestination); return("IDLE"); } if (EventNeedReturnToOwner()) { // return to owner only while IDLE target = null; currentSkill = -1; agent.stoppingDistance = 0; agent.destination = owner.petDestination; return("MOVING"); } if (EventTargetTooFarToFollow()) { // we had a target before, but it's out of follow range now. // clear it and go back to start. don't stay here. target = null; currentSkill = -1; agent.stoppingDistance = 0; agent.destination = owner.petDestination; return("MOVING"); } if (EventTargetTooFarToAttack()) { // we had a target before, but it's out of attack range now. // follow it. (use collider point(s) to also work with big entities) agent.stoppingDistance = CurrentCastRange() * 0.8f; agent.destination = target.collider.ClosestPointOnBounds(transform.position); return("MOVING"); } if (EventSkillRequest()) { // we had a target in attack range before and trying to cast a skill // on it. check self (alive, mana, weapon etc.) and target Skill skill = skills[currentSkill]; if (CastCheckSelf(skill) && CastCheckTarget(skill)) { // start casting and set the casting end time skill.castTimeEnd = Time.time + skill.castTime; skills[currentSkill] = skill; return("CASTING"); } else { // invalid target. stop trying to cast. target = null; currentSkill = -1; return("IDLE"); } } if (EventAggro()) { // target in attack range. try to cast a first skill on it if (skills.Count > 0) { currentSkill = NextSkill(); } else { Debug.LogError(name + " has no skills to attack with."); } return("IDLE"); } if (EventMoveEnd()) { } // don't care if (EventDeathTimeElapsed()) { } // don't care if (EventSkillFinished()) { } // don't care if (EventTargetDisappeared()) { } // don't care return("IDLE"); // nothing interesting happened }