示例#1
0
        public bool InFaceToFace(Hex coord)
        {
            CellObjCtrl cctrl = _GridCtrl.GetCellCtrlAt(coord);
            bool        bIN   = CellObjCtrlUtils.IsFaceToFace(cctrl);

            return(bIN);
        }
示例#2
0
        void TryToAid()
        {
            TryAid(_cellCtrl);


            bool bFaceToFace = CellObjCtrlUtils.IsFaceToFace(_cellCtrl);

            if (bFaceToFace)
            {
                CellObjCtrl fwdCtrl = CellObjCtrlUtils.GetFwdCellObjCtrl(_cellCtrl);
                TryAid(fwdCtrl);
            }
        }
示例#3
0
        void ConfigHole()
        {
            bool bFaceToFace = CellObjCtrlUtils.IsFaceToFace(_cellCtrl);

            //int bwdDir = _cellCtrl.GetBwdDir ();
            MiroModelV1 modelMe        = CellObjCtrlUtils.GetMiroModelFromCell(_cellCtrl);
            CellObjCtrl fwdCtrl        = CellObjCtrlUtils.GetFwdCellObjCtrl(_cellCtrl);
            bool        bFaceToFaceFwd = CellObjCtrlUtils.IsFaceToFace(fwdCtrl);
            MiroModelV1 modelFwd       = CellObjCtrlUtils.GetMiroModelFromCell(fwdCtrl);

            if (modelMe != null)
            {
                ConfigureHole2(modelMe, bFaceToFace);
                //RecordNewFaceToFace (_cellCtrl,fwdCtrl);
                //_HoleON.Invoke ();
            }
            if (modelFwd != null)
            {
                ConfigureHole2(modelFwd, bFaceToFaceFwd);
                //RemoveFaceToFaceRecord (_cellCtrl);
                //_HoleOFF.

                /*
                 * if (modelFwd.name == "Red0" && !bFaceToFace) {
                 *      print ("!FaceToFace");
                 *      CellObjCtrlUtils.IsFaceToFace (_cellCtrl);
                 * }*/
            }

            if (bFaceToFace)
            {
                RecordNewFaceToFace(_cellCtrl, fwdCtrl);
                CaculateAbsorbing(_cellCtrl);
                CaculateAbsorbing(fwdCtrl);
            }
            else
            {
                RemoveFaceToFaceRecord(_cellCtrl);
            }
        }
示例#4
0
        void ConfigHole(CellObjCtrl cellCtrl)
        {
            bool bFaceToFace = CellObjCtrlUtils.IsFaceToFace(cellCtrl);

            MiroModelV1 modelMe  = CellObjCtrlUtils.GetMiroModelFromCell(cellCtrl);
            CellObjCtrl fwdCtrl  = CellObjCtrlUtils.GetFwdCellObjCtrl(cellCtrl);
            MiroModelV1 modelFwd = CellObjCtrlUtils.GetMiroModelFromCell(fwdCtrl);

            if (modelMe != null)
            {
                ConfigureHole2(modelMe, bFaceToFace);
            }
            if (modelFwd != null)
            {
                ConfigureHole2(modelFwd, bFaceToFace);
            }

            if (!bFaceToFace)
            {
                bFaceToFace = CellObjCtrlUtils.IsFaceToFace(cellCtrl);
            }
        }
示例#5
0
        public static bool ShouldBeingAbsorbedToDir(CellObjCtrl cctrl, int relativeDir)
        {
            if (cctrl == null)
            {
                return(false);
            }

            bool bAttacking = CellObjCtrlUtils.ShouldAttacking(cctrl);
            bool bAssisting = CellObjCtrlUtils.ShouldAssistingAttacking(cctrl);

            if (!(bAttacking || bAssisting))
            {
                return(false);
            }


            CellObjCtrl nbCtrl = CellObjCtrlUtils.GetNbCellObjCtrl(cctrl, relativeDir);

            if (nbCtrl == null)
            {
                return(false);
            }

            bool bIsEnemy = CellObjCtrlUtils.IsNbEnemy(cctrl, relativeDir);

            if (!bIsEnemy)
            {
                return(false);
            }

            CellObjCtrl nbBwdCtrl = CellObjCtrlUtils.GetNbCellObjCtrl(nbCtrl, 3);

            if (nbBwdCtrl == null)
            {
                return(false);
            }

            bool bNbBackToMe = (nbBwdCtrl == cctrl);

            if (!bNbBackToMe)
            {
                return(false);
            }

            MiroModelV1 nbModel  = CellObjCtrlUtils.GetMiroModelFromCell(nbCtrl);
            bool        bNbAlive = nbModel.IsAlive();

            if (!bNbAlive)
            {
                return(false);
            }

            bool bNbFaceToFace = CellObjCtrlUtils.IsFaceToFace(nbCtrl);

            if (!bNbFaceToFace)
            {
                return(false);
            }

            CellObjCtrl nbFwdCtrl  = CellObjCtrlUtils.GetFwdCellObjCtrl(nbCtrl);
            MiroModelV1 nbFwdModel = CellObjCtrlUtils.GetMiroModelFromCell(nbFwdCtrl);

            if (!nbFwdModel.IsAlive())
            {
                return(false);
            }


            return(true);
        }