コード例 #1
0
        /// <summary>
        /// 角色移动到某个位置。
        /// </summary>
        public void OnGameEventMovePosition(GameEvent ge, EventParameter parameter)
        {
            int             map = MapMgr.Instance.EnterMapId;
            List <LuaTable> anis;

            if (!m_CacheMapAnimation.TryGetValue(map, out anis))
            {
                return;
            }

            Vector3 pos = (Vector3)parameter.objParameter;

            for (int i = 0; i < anis.Count; ++i)
            {
                LuaTable cfg = anis[i];
                if (cfg.Get <int>("scene") == SCENE_TYPE_POSITION)
                {
                    //判断位置
                    LuaTable   poscfg  = ConfigManager.Instance.Map.GetPositionConfig(cfg.Get <int>("positionid"));
                    List <int> posinfo = UiUtil.SplitNumber(poscfg.Get <string>("pos"), ",");
                    if (posinfo.Count >= 3)
                    {
                        float r = posinfo.Count >= 4 ? posinfo[3] : 3;      //默认3的范围
                        float x = pos.x - posinfo[1];
                        float z = pos.z - posinfo[2];
                        if (x * x + z * z <= r * r)
                        {
                            TryPlayerCutScene(cfg);
                            break;
                        }
                    }
                }
            }
        }