Beispiel #1
0
    public void OnSkillDestroy(NetworkMessage netMsg)
    {
        MObjects.SkillDestroy mObject = netMsg.ReadMessage <MObjects.SkillDestroy>();

        Skill s = Skill.list.Find(x => x.id == mObject.id);

        if (s != null)
        {
            ParticleSystem[] ps = s.GetComponentsInChildren <ParticleSystem>();
            foreach (ParticleSystem p in ps)
            {
                var m = p.main;
                m.loop = false;
                p.Stop(true, ParticleSystemStopBehavior.StopEmitting);
            }

            SoundPlayer_Frequent sfq = s.GetComponent <SoundPlayer_Frequent>();
            if (sfq != null)
            {
                sfq.down = true;
            }

            Destroy(s.gameObject, s.GetComponent <HookScript>() ? 0: 3f);
            Destroy(s);
        }
    }
Beispiel #2
0
    void OnDestroy()
    {
        session.createdSkills.Remove(gameObject);

        if (!started)
        {
            return;
        }

        MObjects.SkillDestroy mObject = new MObjects.SkillDestroy();
        mObject.id = id;

        int _c = session.agents.Count;

        for (int i = 0; i < _c; i++)
        {
            if (session.agents[i].user != null && NetworkServer.connections.Contains(session.agents[i].user))
            {
                // send the mobject
                NetworkServer.SendToClient(session.agents[i].user.connectionId, MTypes.SkillDestroy, mObject);
            }
        }
    }