private bool CanCollideWith(CollisionAbility other) { if (!HasInit || other == null) { return(false); } bool passTypeTest = UseTypeTest ? GamePlay.instance.collisionManager.CanPassTypeTest(this, other) : true; if (passTypeTest) { bool passExclusiveTest = UseExclusiveTest? GamePlay.instance.collisionManager.CanPassExclusiveTest(this, other): true; if (passExclusiveTest) { return(true); } else { ZLog.verbose(owner.name, "fails Exclusive Test with:", other.owner.name); } } else { ZLog.verbose(owner.name, "fails Type Test with type:", other.Type.ToString()); } return(false); }
/// <summary> /// change state immediately with some data /// </summary> public void ChangeState(BaseState <T, M> newState, object param = null) { if (!IsRunning) { ZLog.error("Cannot change state, FSM is not runnning"); return; } if (newState == null) { ZLog.error(_owner.ToString(), "cannot change state to null"); return; } if (_lastSate == null || _curState == null) { ZLog.error(_owner.ToString(), "Fatal error: _lastSate || _curState = null, newState=", newState.ToString()); return; } if (newState.GetType().Equals(_curState.GetType())) { ZLog.warn(_owner.ToString(), "cannot change to the same state:", _curState.ToString()); return; } if (_owner == null) { ZLog.error("_owner = null"); return; } _lastSate = _curState; _curState = newState; ZLog.verbose(_owner.ToString() + ": " + _lastSate.ToString() + " -> " + _curState.ToString()); _lastSate.Exit(_owner); _curState.Enter(_owner, param); }