예제 #1
0
    SceneObjcet GetSceneObject(ulong objId)
    {
        SceneObjcet so = null;

        m_sceneObjects.TryGetValue(objId, out so);
        return(so);
    }
예제 #2
0
    void OnSceneUnitSkillAction(int id, SceneUnitSkillAction msg)
    {
        SceneObjcet so = this.GetSceneObject(msg.SuId);

        if (null == so)
        {
            return;
        }

        so.skillId    = msg.SkillId;
        so.skillStage = msg.Stage;
        if (ESkillState.EssPreparing == msg.Stage)
        {
            Animation animation = so.modelGo.GetComponent <Animation>();
            animation.Play("skill1");
        }
        if (ESkillState.EssReleasing == msg.Stage)
        {
            Animation animation = so.modelGo.GetComponent <Animation>();
            animation.Play("skill2");
        }
        if (ESkillState.EssLasting == msg.Stage)
        {
            Animation animation = so.modelGo.GetComponent <Animation>();
            animation.Play("skill3");
        }
    }
예제 #3
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;
    }
예제 #4
0
    void OnRecvSceneUnitState(int id, SceneUnitState msg)
    {
        SceneObjcet so = this.GetSceneObject(msg.SuId);

        if (null == so)
        {
            so = new SceneObjcet(msg.SuId, msg.UnitType, msg.ModelId);
            m_sceneObjects[so.id] = so;
        }
        so.SetPos(msg.Pos);
        so.faceDir = msg.FaceDir;
    }
예제 #5
0
    void OnRecvSceneObjectState(int id, SceneObjectState msg)
    {
        SceneObjcet so = this.GetSceneObject(msg.Objid);

        if (null == so)
        {
            so = new SceneObjcet(msg.Objid, msg.ObjType, msg.ModelId);
            m_sceneObjects[so.id] = so;
        }
        so.SetPos(msg.Pos);
        so.faceDir = msg.Rotation;
    }
예제 #6
0
 void OnSceneObjectDisappear(int id, SceneObjectDisappear msg)
 {
     foreach (ulong objid in msg.Objids)
     {
         SceneObjcet obj = this.GetSceneObject(objid);
         if (null == obj)
         {
             continue;
         }
         m_sceneObjects.Remove(objid);
         GameObject.Destroy(obj.modelGo);
     }
 }
예제 #7
0
    void OnRecvceneUnitMove(int id, SceneUnitMove msg)
    {
        SceneObjcet so = this.GetSceneObject(msg.SuId);

        if (null == so)
        {
            return;
        }

        if (so.IsPlayingSkill())
        {
            return;
        }

        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");
            }
        }
    }
예제 #8
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");
            }
        }
    }