public RaonLauncherMineSS(Mobile mobile, Vector2 position, Action onMineIsDestroyed) : base(mobile, position, MobileType.RaonLauncherMineSS) { MobileFlipbook = MobileFlipbook.CreateMobileFlipbook(MobileType.RaonLauncherMineSS, position); MobileFlipbook.ChangeState(ActorFlipbookState.Stand, true); this.onMineIsDestroyed = onMineIsDestroyed; Movement = new RaonLauncherMineSSAutomatedMovement(this); Movement.CollisionOffset = 10; Movement.MaximumStepsPerTurn = Parameter.ProjectileRaonLauncherSSMineMaximumStepsPerTurn; if (mobile.Facing == Facing.Right) { Flip(); } CollisionBox = new CollisionBox(this, new Rectangle(0, 0, 8, 8), new Vector2(0, 5)); ((AutomatedMovement)Movement).OnInvalidMovemenAttempt += Flip; ((AutomatedMovement)Movement).OnRemaningMovementEnds += OnCollide; GrantTurn(); }
public override void ChangeFlipbookState(ActorFlipbookState NewState, bool Force = false) { if (NewState == MobileFlipbook.State || NewState == ActorFlipbookState.Stand) { return; } MobileFlipbook.ChangeState(NewState, Force); }
public RaonLauncherMineS2(Mobile mobile, Vector2 position) : base(mobile, position, MobileType.RaonLauncherMineS2) { MobileFlipbook = MobileFlipbook.CreateMobileFlipbook(MobileType.RaonLauncherMineS2, position); MobileFlipbook.ChangeState(ActorFlipbookState.Dormant, true); Movement = new RaonLauncherMineS2AutomatedMovement(this); Movement.CollisionOffset = 10; Movement.MaximumStepsPerTurn = Parameter.ProjectileRaonLauncherS2MineMaximumStepsPerTurn; CollisionBox = new CollisionBox(this, new Rectangle(0, 0, 8, 8), new Vector2(0, 5)); ((AutomatedMovement)Movement).OnInvalidMovemenAttempt += LoseTurn; ((AutomatedMovement)Movement).OnRemaningMovementEnds += () => { Movement.RemainingStepsThisTurn = 0; }; isMoving = false; }
/// <summary> /// Mobile's flipbook change state machine /// </summary> public virtual void ChangeFlipbookState(ActorFlipbookState NewState, bool Force = false) { if (IsHealthCritical) { if (NewState == ActorFlipbookState.Stand) { NewState = ActorFlipbookState.StandLowHealth; } else if (NewState == ActorFlipbookState.Moving) { NewState = ActorFlipbookState.MovingLowHealth; } } if (NewState == MobileFlipbook.State && !IsStateUsingItem(MobileFlipbook.State)) { return; } if (IsStateDead(MobileFlipbook.State)) { return; } if (IsStateUnableToMove(MobileFlipbook.State) && IsStateStand(NewState)) { Force = true; } if (IsStateMoving(MobileFlipbook.State) && IsStateStand(NewState)) { Force = true; } if (IsStateCharging(MobileFlipbook.State) && IsStateStand(NewState)) { return; } //Moving & Shooting condition if (IsStateCharging(MobileFlipbook.State) && IsStateMoving(NewState)) { Force = true; } if (IsStateMoving(MobileFlipbook.State) && IsStateCharging(NewState)) { return; } //Being shot and start moving if (IsStateBeingDamaged(MobileFlipbook.State) && IsStateStand(NewState)) { return; } if (IsStateShooting(MobileFlipbook.State) && IsStateStand(NewState)) { return; } //Stand Condition if (Force || (IsStateStand(MobileFlipbook.State) && (IsStateMoving(NewState) || IsStateEmoting(NewState) || IsStateBeingDamaged(NewState) || IsStateCharging(NewState) || IsStateUsingItem(NewState) || IsStateDead(NewState) || IsStateFalling(NewState))) || //Moving || MovingLowHealth (IsStateMoving(MobileFlipbook.State) && (IsStateStand(NewState) || IsStateDead(NewState) || IsStateShooting(NewState) || IsStateFalling(NewState))) || //Unable to move (IsStateUnableToMove(MobileFlipbook.State) && (IsStateStand(NewState) || IsStateMoving(NewState) || IsStateShooting(NewState))) || //Falling (IsStateFalling(MobileFlipbook.State) && (IsStateStand(NewState) || IsStateMoving(NewState) || IsStateUnableToMove(NewState))) || //Charging (IsStateCharging(MobileFlipbook.State) && (IsStateMoving(NewState) || IsStateUnableToMove(NewState) || IsStateEmoting(NewState) || IsStateBeingDamaged(NewState) || IsStateShooting(NewState) || IsStateUsingItem(NewState)))) { MobileFlipbook.ChangeState(NewState, Force); } }