예제 #1
0
    public void ReceiveRegisterHit(byte[] data)
    {
        HitInfo info = (HitInfo)SerializationToolkit.ByteArrayToObject(data);

        globalHited = true;
        if (OnJoustHit != null)
        {
            OnJoustHit.Invoke(info);
        }

        Fade.Instance.StartFade(0.4f, 0.1f);
        StartCoroutine(UnFade());

        Instantiate(blood, info.hitPoint.Deserialize(), Quaternion.identity);
    }
예제 #2
0
    public void callHit(HitInfo info)
    {
        if (localHited || !_active)
        {
            return;
        }

        localHited  = true;
        globalHited = true;
        lastHit     = (LimbType)info.limbHit;
        float multiplier = 1;

        switch (lastHit)
        {
        case LimbType.Head:
            multiplier = 3;
            break;

        case LimbType.Hand:
            multiplier = 1;
            break;

        case LimbType.Torso:
            multiplier = 2;
            break;
        }

        if (lastHit == LimbType.None)
        {
            return;
        }

        photonView.RPC("CalculateScore", PhotonTargets.All, NetworkPlayerManager.Instance.playerID, multiplier);
        photonView.RPC("ReceiveRegisterHit", PhotonTargets.Others, SerializationToolkit.ObjectToByteArray(info));

        if (OnJoustHit != null)
        {
            OnJoustHit.Invoke(info);
        }

        Instantiate(blood, info.hitPoint.Deserialize(), Quaternion.identity);
    }