Beispiel #1
0
        //[Command]
        void OnTriggerEnter(Collider other)
        {
            Debug.Log("Trigger Entered");
            if (!isServer)
            {
                return;
            }

            Player target = other.gameObject.GetComponent <Player>();

            if (target == null)
            {
                target = other.gameObject.GetComponentInParent <Player>();
            }

            if (target != null)
            {
                if (target.tag == PLAYER_TAG)
                {
                    CmdPlayerShot(target.GetPlayerID(), Damage);
                }
            }
            else
            {
                NetworkInstanceId cloneTarget = other.gameObject.GetComponentInParent <NetworkIdentity>().netId;

                CmdCloneShot(cloneTarget, Damage);
            }

            CmdDestroy();
        }