public override void Enter(Actor owner, ActorAIController ownerAI) { base.Enter(owner, ownerAI); ownerAI.ChaseTarget = GameSystem.Instance.ActorManager.GetRandomPlayer(); this.currentDirection = this.GetTargetDirection(owner, ownerAI); this.GetObserver(owner) .SubscribeWithState3(this, owner, ownerAI, (_, _this, _owner, _ownerAI) => { _owner.StatusController.SetMoveSpeedRate(_this.moveSpeedRate); _owner.Broker.Publish(RequestMove.Get(_this.currentDirection.ToVector2())); if (_this.IsReverse(_owner, _ownerAI)) { _this.changeDirectionDuration += Time.deltaTime; } else { _this.changeDirectionDuration = 0.0f; } if (_this.changeDirectionDuration > _this.changeDirectionDelay) { _this.changeDirectionDuration = 0.0f; _this.currentDirection = _this.GetTargetDirection(_owner, _ownerAI); } }) .AddTo(this.events); }
public override void Enter(Actor owner, ActorAIController ownerAI) { base.Enter(owner, ownerAI); this.GetObserver(owner) .SubscribeWithState2(this, owner, (_, _this, _owner) => { _owner.Broker.Publish(Messages.RequestFire.Get(_this.equipmentIndex)); }) .AddTo(this.events); }
public override void Enter(Actor owner, ActorAIController ownerAI) { base.Enter(owner, ownerAI); this.GetObserver(owner) .SubscribeWithState2(this, owner, (_, _this, _owner) => { ownerAI.ChangeAI(this.nextAIName); }) .AddTo(this.events); }
private Constants.Direction GetTargetDirection(Actor owner, ActorAIController ownerAI) { var result = new Vector2(ownerAI.ChaseTarget.CachedTransform.position.x - owner.CachedTransform.position.x, 0.0f).GetHorizontalDirection(); if (!this.isChase) { result = result.ToReverse(); } return(result); }
public override void Enter(Actor owner, ActorAIController ownerAI) { base.Enter(owner, ownerAI); this.GetObserver(owner) .SubscribeWithState2(this, owner, (_, _this, _owner) => { _owner.Broker.Publish(RequestJump.Get()); }) .AddTo(this.events); }
public virtual void Enter(Actor owner, ActorAIController ownerAI) { if (this.instanceConditions == null) { this.instanceConditions = new List <IObservable <Unit> >(this.conditions.Count); foreach (var condition in this.conditions) { var instance = UnityEngine.Object.Instantiate(condition); this.instanceConditions.Add(instance.Satisfy(owner, ownerAI)); } } }
public override void Exit(Actor owner, ActorAIController ownerAI) { base.Exit(owner, ownerAI); if (this.removeOnExit) { for (var i = 0; i < this.addCount; i++) { foreach (var o in this.itemModifiers) { owner.StatusController.RemoveOtherItemModifier(o); } } } }
public override void Enter(Actor owner, ActorAIController ownerAI) { base.Enter(owner, ownerAI); this.velocity = this.velocities[Random.Range(0, this.velocities.Count)]; this.GetObserver(owner) .SubscribeWithState3(this, owner, ownerAI, (_, _this, _owner, _ownerAI) => { _owner.StatusController.SetMoveSpeedRate(_this.moveSpeedRate); _owner.Broker.Publish(RequestMove.Get(_this.velocity)); }) .AddTo(this.events); }
public override void Enter(Actor owner, ActorAIController ownerAI) { base.Enter(owner, ownerAI); this.addCount = 0; this.GetObserver(owner) .SubscribeWithState2(this, owner, (_, _this, _owner) => { foreach (var i in _this.itemModifiers) { owner.StatusController.AddOtherItemModifier(i); } _this.addCount++; }) .AddTo(this.events); }
private bool IsReverse(Actor owner, ActorAIController ownerAI) { var direction = owner.StatusController.Direction; if (!this.isChase) { direction = direction.ToReverse(); } var diff = ownerAI.ChaseTarget.CachedTransform.position.x - owner.CachedTransform.position.x; if ((direction == Constants.Direction.Left && diff > 0.0f) || (direction == Constants.Direction.Right && diff < 0.0f)) { return(true); } return(false); }
private bool SatisfyFromDistance(Actor owner, ActorAIController ownerAI) { var diff = (ownerAI.ChaseTarget.CachedTransform.position - owner.CachedTransform.position).sqrMagnitude; var d = this.distance * this.distance; switch (this.type) { case CompareType.Greater: return(d < diff); case CompareType.Less: return(d > diff); default: Assert.IsTrue(false, $"{this.type}は未対応です"); return(false); } }
public override IObservable <Unit> Satisfy(Actor owner, ActorAIController ownerAI) { return(owner.UpdateAsObservable().Where(_ => this.SatisfyFromDistance(owner, ownerAI))); }
public override IObservable <Unit> Satisfy(Actor owner, ActorAIController ownerAI) { return(owner.Broker.Receive <TakedDamage>().AsUnitObservable()); }
public override IObservable <Unit> Satisfy(Actor owner, ActorAIController ownerAI) { return(Observable.Interval(TimeSpan.FromSeconds(this.seconds)).AsUnitObservable()); }
public virtual void Exit(Actor owner, ActorAIController ownerAI) { this.events.Clear(); }
public abstract IObservable <Unit> Satisfy(Actor owner, ActorAIController ownerAI);
public override IObservable <Unit> Satisfy(Actor owner, ActorAIController ownerAI) { return(owner.Broker.Receive <Messages.Landed>().AsUnitObservable()); }
public override void Exit(Actor owner, ActorAIController ownerAI) { base.Exit(owner, ownerAI); ownerAI.ChaseTarget = null; }
public override IObservable <Unit> Satisfy(Actor owner, ActorAIController ownerAI) { return(owner.UpdateAsObservable().Take(1)); }