public EntityFacade( IMonoEntity entity, IActorStateModel actor, IPauseStateModel pauseStateModel) { Entity = entity; Actor = actor; _pauseStateModel = pauseStateModel; _entityLifecycleDisposable = new SerialDisposable().AddTo(Disposer); Entity.Setup(Actor); Actor.Get <TransformDataComponent>() .SetMonoEntity(Entity); HealthDataComponent = Actor.Get <HealthDataComponent>(); HealthDataComponent.IsAlive .DelayFrame(1) .Subscribe(OnIsAliveChanged) .AddTo(Disposer); Observable.EveryUpdate() .Where(_ => CanTick) .Subscribe(_ => OnTick()) .AddTo(Disposer); }
public FollowAvatarNode(IActorStateModel actorStateModel) { _actorStateModel = actorStateModel; _blackBoard = _actorStateModel.Get <BlackBoardDataComponent>(); _sensorDataComponent = _actorStateModel.Get <SensorDataComponent>(); _transformDataComponent = _actorStateModel.Get <TransformDataComponent>(); _timeoutDataComponent = _actorStateModel.Get <TimeoutDataComponent>(); }
public FirstTouchNode( IActorStateModel actorStateModel, BehaviourTreeConfig behaviourTreeConfig) { _behaviourTreeConfig = behaviourTreeConfig; _sensorDataComponent = actorStateModel.Get <SensorDataComponent>(); _relationshipDataComponent = actorStateModel.Get <RelationshipDataComponent>(); }
public EnterScreenNode( IActorStateModel actorStateModel, AiMovementController aiMovementController, ScreenSizeModel screenSizeModel) { _aiMovementController = aiMovementController; _screenSizeModel = screenSizeModel; _originDataComponent = actorStateModel.Get <OriginDataComponent>(); _transformDataComponent = actorStateModel.Get <TransformDataComponent>(); }
public WanderNode( IActorStateModel actorStateModel, IRandomNumberService randomNumberService, ScreenSizeModel screenSizeModel) { _randomNumberService = randomNumberService; _screenSizeModel = screenSizeModel; _blackBoard = actorStateModel.Get <BlackBoardDataComponent>(); _originDataComponent = actorStateModel.Get <OriginDataComponent>(); _wanderDataComponent = actorStateModel.Get <WanderDataComponent>(); _transformDataComponent = actorStateModel.Get <TransformDataComponent>(); }
private float GetDistanceSquared(IActorStateModel actorA, IActorStateModel actorB) { var distance = actorA.Get <TransformDataComponent>().Position - actorB.Get <TransformDataComponent>().Position; return(distance.sqrMagnitude); }
public SwitchEntityStateNode( IActorStateModel actorStateModel, EntityState targetState) { _relationshipDataComponent = actorStateModel.Get <RelationshipDataComponent>(); _targetState = targetState; }
public MoveNode( IActorStateModel actorStateModel, AiMovementController aiMovementController) { _aiMovementController = aiMovementController; _blackBoard = actorStateModel.Get <BlackBoardDataComponent>(); }
private void TryAddAsAvatar(IActorStateModel actor) { if (actor.Get <EntityTypeDataComponent>().EntityType == EntityType.Avatar) { Avatar = actor; } }
private void TryRemoveAsAvatar(IActorStateModel actor) { if (actor.Get <EntityTypeDataComponent>().EntityType == EntityType.Avatar) { Avatar = null; } }
public ResetTimeoutNode( IActorStateModel actorStateModel, TimeoutDataComponent.Storage storage) { _storage = storage; _timeoutDataComponent = actorStateModel.Get <TimeoutDataComponent>(); }
public IdleTimeoutNode( IActorStateModel actor, double timeoutSeconds, TimeoutDataComponent.Storage storage) { _timeoutDataComponent = actor.Get <TimeoutDataComponent>(); _timeoutSeconds = timeoutSeconds; _storage = storage; }
public EntityStateNotificationSystem(IActorStateModel actor) : base(actor) { _relationshipDataComponent = actor.Get <RelationshipDataComponent>(); _components = actor.GetAll <IEntityStateSensitiveDataComponent>(); _relationshipDataComponent.Relationship .Subscribe(OnRelationShipChanged) .AddTo(Disposer); }
public IdleTimeoutRandomNode( IActorStateModel actor, double timeoutSeconds, TimeoutDataComponent.Storage storage, double randomChance) { _timeoutDataComponent = actor.Get <TimeoutDataComponent>(); _timeoutSeconds = timeoutSeconds; _storage = storage; _randomChance = randomChance; }
public void Add(IActorStateModel actor, SensorType sensor) { _storages[sensor].Add(actor); if (!_lifetimeSubscriptions.ContainsKey(actor)) { var sub = actor.Get <HealthDataComponent>().IsAlive .IfFalse() .Subscribe(_ => Remove(actor, sensor)) .AddTo(Disposer); _lifetimeSubscriptions.Add(actor, sub); } }
public FindDamageReceiversNode(IActorStateModel actorStateModel) { _blackBoard = actorStateModel.Get <BlackBoardDataComponent>(); _sensorDataComponent = actorStateModel.Get <SensorDataComponent>(); }
public LightSwitchNode(IActorStateModel actorStateModel) { _lightDataComponent = actorStateModel.Get <LightDataComponent>(); }
public AbstractMovementController(IActorStateModel actorStateModel) { MovementDataComponent = actorStateModel.Get <MovementDataComponent>(); TransformDataComponent = actorStateModel.Get <TransformDataComponent>(); }
private bool IsEntityState(IActorStateModel model, EntityState status) { var relationshipDataComponent = model.Get <RelationshipDataComponent>(); return(relationshipDataComponent.Relationship.Value == status); }
public DamageActorNode(IActorStateModel actorStateModel) { _blackBoardDataComponent = actorStateModel.Get <BlackBoardDataComponent>(); _damageDataComponent = actorStateModel.Get <DamageDataComponent>(); }
private void StoreDamageReceiver(IActorStateModel actor) { var receiver = actor.Get <HealthDataComponent>(); _blackBoard.DamageReceiver.Store(receiver); }
public DeactivateSelfNode(IActorStateModel actorStateModel) { _healthDataComponent = actorStateModel.Get <HealthDataComponent>(); }
private bool IsFriend(IActorStateModel actor) { return(actor.Get <RelationshipDataComponent>()?.Relationship.Value == EntityState.Friend); }
public NearDeathNode(IActorStateModel actorStateModel) { _healthDataComponent = actorStateModel.Get <HealthDataComponent>(); }