コード例 #1
0
    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
    }
コード例 #2
0
 void Cmdkill()
 {
     Destroy(this.gameObject);
     NetworkServer.Destroy(this.gameObject);
 }
コード例 #3
0
ファイル: ItemPickup.cs プロジェクト: Jackson-Luu/FPS-Project
 public void Despawn()
 {
     NetworkServer.Destroy(gameObject);
 }
コード例 #4
0
 private void DestroySelf()
 {
     NetworkServer.Destroy(gameObject);
 }
コード例 #5
0
 private void Kill()
 {
     // Destroy the projectile for all clients
     NetworkServer.Destroy(gameObject);
 }
コード例 #6
0
 //Destroying Projectile
 private void DestroyProjectile()
 {
     NetworkServer.Destroy(gameObject);
 }
コード例 #7
0
 void DestroyMe()
 {
     NetworkServer.Destroy(gameObject);
 }
コード例 #8
0
 public void Deplete()
 {
     NetworkServer.Destroy(gameObject);
 }
コード例 #9
0
ファイル: BoxBreakerHandler.cs プロジェクト: JohnLore/bebe
 void CmdPleaseDestroyThisThing(GameObject thing)
 {
     NetworkServer.UnSpawn(thing);
     NetworkServer.Destroy(thing);
 }
コード例 #10
0
 void OnTriggerEnter(Collider co)
 {
     NetworkServer.Destroy(gameObject);
 }
コード例 #11
0
ファイル: WorldController.cs プロジェクト: Andrioden/Robocodo
    private IEnumerator DestroyNetworkObject(GameObject GO, float delay)
    {
        yield return(new WaitForSeconds(delay));

        NetworkServer.Destroy(GO);
    }
コード例 #12
0
 void OnTriggerEnter(Collider other)
 {
     NetworkServer.Destroy(gameObject);
     NetworkServer.Destroy(other.gameObject);
 }
コード例 #13
0
    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
    }
コード例 #14
0
    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
    }
コード例 #15
0
    private void CmdDespawn(uint netID)
    {
        GameObject gm = NetworkIdentity.spawned[netID].gameObject;

        NetworkServer.Destroy(gm);
    }
コード例 #16
0
    IEnumerator DestroyAfter()
    {
        yield return(new WaitForSeconds(timeBeforeDestruction));

        NetworkServer.Destroy(gameObject);
    }
コード例 #17
0
 void CmdDie(GameObject bbb)
 {
     Destroy(bbb.gameObject);
     NetworkServer.Destroy(bbb.gameObject);
 }
コード例 #18
0
        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);
        }
コード例 #19
0
ファイル: Shot.cs プロジェクト: N1cc3/unity-multiplayer-game
 private void Remove()
 {
     NetworkServer.Destroy(gameObject);
 }
コード例 #20
0
    private IEnumerator WaitToDestroy()
    {
        yield return(new WaitForSeconds(5f));

        NetworkServer.Destroy(gameObject);
    }
コード例 #21
0
 void CmdDestroyNow()
 {
     NetworkServer.Destroy(this.gameObject);
 }
コード例 #22
0
ファイル: PlayerController.cs プロジェクト: 0307kwon/3D_Craft
 public void CmdDestroy(GameObject obj)
 {
     NetworkServer.Destroy(obj);
 }
コード例 #23
0
 void CmdDestroyObject(GameObject obj)
 {
     //if (!obj) return;
     NetworkServer.Destroy(obj);
 }
コード例 #24
0
 void CmdDestroyCrown()
 {
     NetworkServer.Destroy(GameObject.FindGameObjectWithTag("holy_grail"));
     Debug.Log("Holy grail has been destroyed!!!!!");
 }
コード例 #25
0
ファイル: UnitSpawner.cs プロジェクト: jjaslow/TankAttack
 private void ServerHandleDie()
 {
     NetworkServer.Destroy(gameObject);
 }
コード例 #26
0
 void OnDeath()
 {
     // disappear forever
     NetworkServer.Destroy(gameObject);
 }
コード例 #27
0
    //***********************************************************************************************************************************************************************************
    // CoRoutine that kills the bomb off one second after the routine is called
    //***********************************************************************************************************************************************************************************
    public IEnumerator deleteSelf()
    {
        yield return(new WaitForSeconds(1));

        NetworkServer.Destroy(gameObject);
    }
コード例 #28
0
ファイル: Projectile.cs プロジェクト: zhanggvi/Pixel-PUBG
 void OnDead()
 {
     NetworkServer.Destroy(this.gameObject);
 }
コード例 #29
0
ファイル: SegmentSpawner.cs プロジェクト: JackSouthard1/Poly
 public void CmdCollectSegment(GameObject segment)
 {
     segmentCount--;
     NetworkServer.Destroy(segment);
 }
コード例 #30
0
    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
    }