示例#1
0
    private void OnCollisionEnter(Collision collision)
    {
        SyncPosRot script = collision.collider.gameObject.GetComponent <SyncPosRot>();

        if (script != null)
        {
            KBEngine.Entity player = KBEngine.KBEngineApp.app.player();
            if (script.entity != null && player != null)
            {
                if (script.entity.id == player.id)
                {
                    if ((Int32)entity.getDefinedProperty("controllId") != player.id)
                    {
                        entity.cellCall("reqControll", new object[] { player.id });
                    }
                }
            }
        }
    }
示例#2
0
    private void UpdateAnimateState()
    {
        if (isLocalPlayer)
        {
            bool change = false;
            if (bLastDie != bDie)
            {
                DieOrRelive();
                change = true;
            }

            if (bLastRun != bRun)
            {
                m_Animator.SetBool("run", bRun);
                bLastRun = bRun;
                change   = true;
            }

            if (iLastAtk != iAtk)
            {
                m_Animator.SetInteger("atk", iAtk);
                iLastAtk = iAtk;
                change   = true;
            }

            if (Globe.netMode && change)
            {
                aniSyncInfo["die"] = bDie;
                aniSyncInfo["run"] = bRun;
                aniSyncInfo["atk"] = iAtk;
                KBEngine.PropsEntity player = GetComponent <SyncPosRot>().entity;
                if (player != null)
                {
                    player.cellCall("reqSyncAniState", new object[] { aniSyncInfo });
                }
            }
        }
    }
示例#3
0
    protected virtual bool UpdateTransAniState()
    {
        if (!isLocalPlayer)
        {
            return(false);
        }

        AnimatorStateInfo asInfo = m_Animator.GetCurrentAnimatorStateInfo(0);

        if (asInfo.IsName("die"))
        {
            if (!bHasReqRelive && asInfo.normalizedTime >= 0.95f)
            {
                KBEngine.PropsEntity player = GetComponent <SyncPosRot>().entity;
                if (player != null)
                {
                    player.cellCall("reqRelive");
                }
                bHasReqRelive = true;
            }
        }
        return(true);
    }