public override void SetCannotFlag(CannotFlag flag, OptType type, bool cannot) { if (flag == CannotFlag.CannotControl && cannot) { IsControl = false; } base.SetCannotFlag(flag, type, cannot); }
public virtual void SetCannotFlag(CannotFlag flag, OptType type, bool cannot) { int mask = mCannotFlag[(int)flag]; if (cannot) { mask |= (1 << (int)type); } else { mask &= ~(1 << (int)type); } mCannotFlag[(int)flag] = mask; }
void SetFlag(StateMgr stateMgr, CannotFlag flag, bool v) { if (v) { int count = stateMgr.mCannotFlagCount[(int)flag] + 1; stateMgr.mCannotFlagCount[(int)flag] = count; if (count == 1) { stateMgr.mOwner.SetCannotFlag(flag, OptType.State, true); } } else { int count = stateMgr.mCannotFlagCount[(int)flag] - 1; if (count <= 0) { count = 0; stateMgr.mOwner.SetCannotFlag(flag, OptType.State, false); } stateMgr.mCannotFlagCount[(int)flag] = count; } }
public bool IsCannotFlag(CannotFlag flag) { int mask = mCannotFlag[(int)flag]; return(mask != 0); }