Пример #1
0
    void OnRecvSceneUnitTransform(int id, SceneUnitTransform msg)
    {
        SceneObjcet so = this.GetSceneObject(msg.SuId);

        if (null == so)
        {
            return;
        }

        so.SetPos(msg.Pos);
        so.faceDir = msg.FaceDir;
    }
Пример #2
0
    void OnRecvMoveObjectMutableState(int id, MoveObjectMutableState msg)
    {
        SceneObjcet so = this.GetSceneObject(msg.Objid);

        if (null == so)
        {
            return;
        }

        so.SetPos(msg.Pos);
        so.faceDir = msg.Rotation;
        if (msg.MoveAgentState == EMoveAgentState.MoveToPos ||
            msg.MoveAgentState == EMoveAgentState.MoveToDir)
        {
            Animation animation = so.modelGo.GetComponent <Animation>();
            if (!animation.IsPlaying("run"))
            {
                animation.Play("run");
            }
        }
        else if (msg.MoveAgentState == EMoveAgentState.ForceLine ||
                 msg.MoveAgentState == EMoveAgentState.ForcePos)
        {
            Animation animation = so.modelGo.GetComponent <Animation>();
            if (!animation.IsPlaying("knockUpStill"))
            {
                animation.Play("knockUpStill");
            }
        }
        else
        {
            Animation animation = so.modelGo.GetComponent <Animation>();
            if (!animation.IsPlaying("idle"))
            {
                animation.Play("idle");
            }
        }
    }