Ejemplo n.º 1
0
        /// <summary>
        /// 往平台组件中注册遮挡关系
        /// </summary>
        /// <param name="manager"></param>
        public void RegistShelter(SmartTank.Shelter.ShelterMgr manager)
        {
            foreach (MulPair pair in shelterGroups)
            {
                try
                {
                    List <IEnumerable <IShelterObj> > shelGroups = new List <IEnumerable <IShelterObj> >();

                    foreach (string shelGroupPath in pair.groupPaths)
                    {
                        TypeGroup shelGroup = FindGroup(shelGroupPath) as TypeGroup;
                        shelGroups.Add(shelGroup.GetEnumerableCopy <IShelterObj>());
                    }

                    TypeGroup group = FindGroup(pair.groupPath) as TypeGroup;

                    manager.AddRaderShelterGroup(
                        group.GetEnumerableCopy <IRaderOwner>(),
                        shelGroups.ToArray());
                }
                catch (Exception ex)
                {
                    Log.Write("RegistShelterGroup error: " + pair.groupPath + ex.Message);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 往平台组件中注册可视关系
        /// </summary>
        /// <param name="manager"></param>
        public void RegistVision(SmartTank.Senses.Vision.VisionMgr manager)
        {
            foreach (MulPair pair in visionGroups)
            {
                try
                {
                    //TypeGroup group1 = FindGroup( pair.groupPath ) as TypeGroup;
                    //TypeGroup group2 = FindGroup( pair.groupPath2 ) as TypeGroup;
                    //manager.AddVisionGroup(
                    //    group1.GetEnumerableCopy<IRaderOwner>(),
                    //    group2.GetEnumerableCopy<IEyeableObj>() );
                    List <IEnumerable <IEyeableObj> > EyeableGroups = new List <IEnumerable <IEyeableObj> >();

                    foreach (string eyeGroupPath in pair.groupPaths)
                    {
                        TypeGroup shelGroup = FindGroup(eyeGroupPath) as TypeGroup;
                        EyeableGroups.Add(shelGroup.GetEnumerableCopy <IEyeableObj>());
                    }

                    TypeGroup group = FindGroup(pair.groupPath) as TypeGroup;

                    manager.AddVisionGroup(
                        group.GetEnumerableCopy <IRaderOwner>(),
                        EyeableGroups.ToArray());
                }
                catch (Exception ex)
                {
                    Log.Write("RegistVisionGroup error: " + pair.groupPath + ", " +
                              pair.groupPath.ToString() + ", " + ex.Message);
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 往平台组件中注册物理更新
        /// </summary>
        /// <param name="manager"></param>
        public void RegistPhiCol(SmartTank.PhiCol.PhiColMgr manager)
        {
            foreach (string groupPath in phiGroups)
            {
                try
                {
                    TypeGroup group = FindGroup(groupPath) as TypeGroup;
                    manager.AddPhiGroup(group.GetEnumerableCopy <IPhisicalObj>());
                }
                catch (Exception ex)
                {
                    Log.Write("RegistPhiGroup error: " + groupPath + ", " + ex.Message);
                }
            }

            foreach (string groupPath in colSinGroups)
            {
                try
                {
                    TypeGroup group = FindGroup(groupPath) as TypeGroup;
                    manager.AddCollideGroup(group.GetEnumerableCopy <ICollideObj>());
                }
                catch (Exception ex)
                {
                    Log.Write("RegistColSinGroup error: " + groupPath + ", " + ex.Message);
                }
            }

            foreach (string groupPath in lapSinGroups)
            {
                try
                {
                    TypeGroup group = FindGroup(groupPath) as TypeGroup;
                    manager.AddOverlapGroup(group.GetEnumerableCopy <ICollideObj>());
                }
                catch (Exception ex)
                {
                    Log.Write("RegistLapSinGroup error: " + groupPath + ", " + ex.Message);
                }
            }

            foreach (Pair pair in colPairGroups)
            {
                try
                {
                    TypeGroup group1 = FindGroup(pair.groupPath1) as TypeGroup;
                    TypeGroup group2 = FindGroup(pair.groupPath2) as TypeGroup;
                    manager.AddCollideGroup(
                        group1.GetEnumerableCopy <ICollideObj>(),
                        group2.GetEnumerableCopy <ICollideObj>());
                }
                catch (Exception ex)
                {
                    Log.Write("RegistColPairGroup error: " + pair.groupPath1 + ", " +
                              pair.groupPath2 + ", " + ex.Message);
                }
            }

            foreach (Pair pair in lapPairGroups)
            {
                try
                {
                    TypeGroup group1 = FindGroup(pair.groupPath1) as TypeGroup;
                    TypeGroup group2 = FindGroup(pair.groupPath2) as TypeGroup;
                    manager.AddOverlapGroup(
                        group1.GetEnumerableCopy <ICollideObj>(),
                        group2.GetEnumerableCopy <ICollideObj>());
                }
                catch (Exception ex)
                {
                    Log.Write("RegistLapPairGroup error: " + pair.groupPath1 + ", " +
                              pair.groupPath2 + ", " + ex.Message);
                }
            }
        }