/* * public static bool IsNbEnemy(CellObjCtrl cctrl, int relativeDir) * { * if (cctrl._TgtObj == null) { * return false; * } * * CellObjCtrl nbCtrl = GetNbCellObjCtrl (cctrl, relativeDir); * bool bEnemy = false; * if (nbCtrl != null && nbCtrl._TgtObj!=null) { * var settingMe = * cctrl._TgtObj.GetComponent<MiroV1ModelSetting> (); * var settingNb = * nbCtrl._TgtObj.GetComponent<MiroV1ModelSetting> (); * bEnemy = (settingMe._CampName!=settingNb._CampName); * } * * return bEnemy; * }*/ public static bool IsBackToBack(CellObjCtrl ctrl) { if (ctrl == null || ctrl._TgtObj == null) { return(false); } bool bBwdFriend = CellObjCtrlUtils.IsNbSameCamp(ctrl, 3); if (bBwdFriend) { CellObjCtrl bwdCtrl = GetNbCellObjCtrl(ctrl, 3); if (bwdCtrl.GetDir() == ctrl.GetBwdDir()) { return(true); } else { return(false); } } else { return(false); } }
public static bool IsFaceToFace(CellObjCtrl ctrl) { if (ctrl == null || ctrl._TgtObj == null) { return(false); } bool bFwdFriend = CellObjCtrlUtils.IsNbSameCamp(ctrl, 0); if (bFwdFriend) { CellObjCtrl fwdCtrl = GetNbCellObjCtrl(ctrl, 0); if (fwdCtrl.GetDir() == ctrl.GetBwdDir()) { return(true); } else { return(false); } } else { return(false); } }
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); } } }