Example #1
0
    /// <summary>
    /// 1.获取当前玩家的playerID
    /// 2.创建一个SceneEntityObject 作为Entity的renderObj
    /// </summary>
    /// <param name="entity"></param>
    public void onEnterWorld(KBEngine.Entity entity)
    {
        Debug.Log("实体进入世界 KBEEventProc::onEnterWorld  entityID:" + entity.id);
        if (entity.renderObj != null)
        {
            Debug.LogWarning("实体已经有renderObj 无法再次进入");
            return;
        }

        SceneEntityObject obj = new SceneEntityObject();

        obj.kbentity     = entity;
        entity.renderObj = obj;


        if (entity.isPlayer())
        {
            currentPlayerID = Convert.ToInt16(entity.getDefinedProperty("playerID"));
        }
        else
        {
        }

        obj.onEnterWorld(entity.getDefinedProperty("playerID"));
    }