Beispiel #1
0
		override protected void _Calculate()
		{
			CellObjCtrl ctrlBwd = 
				CellObjCtrlUtils.GetNbCellObjCtrl (_cellCtrl, 3);
			if (_cellCtrl._TgtObj == null) {
				return;
			}

			bool bBackToBack = CellObjCtrlUtils.IsBackToBack (_cellCtrl);

			MiroModelV1 modelMe = 
				_cellCtrl._TgtObj.GetComponent<MiroModelV1> ();
			bool bHasFarm = modelMe.HasFarm ();
			bool bToGrow = (!bHasFarm && bBackToBack);
			bool bToShrink = (bHasFarm && !bBackToBack);
			if (bToGrow) {
				MiroModelV1 modelBwd = 
					ctrlBwd._TgtObj.GetComponent<MiroModelV1> ();
				_mgr.CreateEN2FarmFor2 (
					modelMe,_cellCtrl.transform, 
					modelBwd,ctrlBwd.transform);
				RecordNewFarm (_cellCtrl, ctrlBwd);
				//Debug.Log ("GrowFarm2 at " + _cellCtrl);
			} else if (bToShrink) {
				ShrinkFarm2 (_cellCtrl);
				//Debug.Log ("ShrinkFarm2 at " + _cellCtrl);
			}

		}
Beispiel #2
0
        public bool InBackToBack(Hex coord)
        {
            CellObjCtrl cctrl = _GridCtrl.GetCellCtrlAt(coord);
            bool        bIN   = CellObjCtrlUtils.IsBackToBack(cctrl);

            return(bIN);
        }
Beispiel #3
0
        override protected void _Calculate()
        {
            bool bCtrlling = CellObjCtrlUtils.IsControllingObj(_cellCtrl);

            if (!bCtrlling)
            {
                return;
            }
            MiroModelV1 modelMe =
                _cellCtrl._TgtObj.GetComponent <MiroModelV1> ();

            modelMe._bTurnMainWeaponByEN = false;

            bool bFwdEmpty   = CellObjCtrlUtils.IsNbEmpty(_cellCtrl, 0);
            bool bFwdEnemy   = CellObjCtrlUtils.IsNbEnemy(_cellCtrl, 0);
            bool bBackToBack = CellObjCtrlUtils.IsBackToBack(_cellCtrl);
            int  en          = bBackToBack ? 3 : 1;

            if (bFwdEmpty || bFwdEnemy)
            {
                SetEN(modelMe, en);
                return;
            }

            bool bFwdFriend = CellObjCtrlUtils.IsNbSameCamp(_cellCtrl, 0);

            if (bFwdFriend)
            {
                CellObjCtrl fwdCtrl          = CellObjCtrlUtils.GetNbCellObjCtrl(_cellCtrl, 0);
                bool        bFriendFaceEnemy = CellObjCtrlUtils.IsNbEnemy(fwdCtrl, 0);
                bool        bFriendFaceEmpty = CellObjCtrlUtils.IsNbEmpty(fwdCtrl, 0);
                bool        bFriendAttack    = (bFriendFaceEnemy || bFriendFaceEmpty);
                if (bFriendAttack)
                {
                    SetEN(modelMe, en);
                }
                else
                {
                    SetEN(modelMe, 0);
                }
            }
        }