protected override void Awake () { base.Awake (); _stepStateExecutor = new StepState(this); _standStateExecutor = new StandState(this); _turningStateExecutor = new TurningState(this); }
/// <summary> /// Code for the action that gets called in OldMan's update /// </summary> /// <param name="om">The Old Man script</param> public override void ExecuteAction(OldMan om) { if (!Active || Completed) { return; } //State control switch (state) { case StandState.Walking: if (!om.Agent.pathPending && om.Agent.remainingDistance < 0.3f) { state = StandState.Standing; } break; case StandState.Standing: //Infinite stand if (standLength <= 0) { return; } //Timed stand timer += Time.deltaTime; if (timer > standLength) { CompleteAction(); } break; } }
private void Hentai_OnStateUpdate(StandState sender) { Owner.direction = attackDir; projectile.Center = Vector2.SmoothStep(projectile.Center, Owner.Center + Owner.Center.DirectTo(MousePosition, Range * 32), 0.35f); Owner.heldProj = projectile.whoAmI; var frameRequired = forwardFlip ? 5 : 3; if (Animations[CurrentAnimation].CurrentFrame == frameRequired && !hasShot) { hasShot = true; var type = ModContent.ProjectileType <MILFHunterTendril>(); var mult = SpriteFX == SpriteEffects.FlipHorizontally ? 1 : -1; Vector2 off = new Vector2(30 * mult, -4); var pos = projectile.Center + off; int proj = Projectile.NewProjectile(pos, pos.DirectTo(MousePosition, 18f), type, EmeraldDamage * 2, 2f, projectile.owner, MILFHunterTendril.TendrilLength, projectile.whoAmI); if (Main.projectile[proj].modProjectile is MILFHunterTendril tendril) { var flip = forwardFlip; tendril.flipped = Owner.direction == -1? flip : !flip; } } }
private void SummonState_OnStateBegin(StandState sender) { TBAR.Instance.PlayVoiceLine("Sounds/TheWorld/Teleport"); TBAR.Instance.PlayVoiceLine("Sounds/TheWorld/Call"); projectile.Center = Owner.Center + new Vector2(-30 * Owner.direction, -32); }
private void FlyUpState_OnStateUpdate(StandState sender) { Owner.noFallDmg = true; projectile.Center -= new Vector2(0, 16); Owner.velocity = Vector2.Zero; Owner.Center = projectile.Center + new Vector2(0, 32); }
public void Excute(CharacterMove t) { if (t.isStandingEnd) { t.stateMachine.ChangeState(StandState.GetInstance()); } }
private void NormalAttack_OnStateBegin(StandState sender) { attackDir = MousePosition.X < Owner.Center.X ? -1 : 1; hasShot = false; Owner.direction = attackDir; SpriteFX = Owner.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; }
private void DespawnState_OnStateUpdate(StandState sender) { if (Animations[CurrentAnimation].CurrentFrame == 17) { TBAR.Instance.PlayVoiceLine("Sounds/TheWorld/Teleport"); } }
protected StandState AddState(string key, int duration = 0) { StandState output = new StandState(duration); States.Add(key, output); return(output); }
public sealed override void ReceiveExtraAI(BinaryReader reader) { State = (StandState)reader.ReadByte(); _standSpriteEffects = (SpriteEffects)reader.ReadByte(); _positionOffsetX = reader.ReadInt32(); _attackCounter = reader.ReadInt32(); }
public static void HandleEmote(WorldSession session, ClientEmote emote) { StandState standState = StandState.Stand; if (emote.EmoteId != 0) { EmotesEntry entry = GameTableManager.Instance.Emotes.GetEntry(emote.EmoteId); if (entry == null) { throw (new InvalidPacketValueException("HandleEmote: Invalid EmoteId")); } standState = (StandState)entry.StandState; } if (emote.EmoteId == 0 && session.Player.IsSitting) { session.Player.Unsit(); } session.Player.EnqueueToVisible(new ServerEmote { Guid = session.Player.Guid, StandState = standState, EmoteId = emote.EmoteId }); }
private void DespawnState_OnStateUpdate(StandState sender) { Opacity -= 0.02f; for (int i = 0; i < 5; i++) { int dustIndex = Dust.NewDust(new Vector2(projectile.Center.X, projectile.Center.Y) + (projectile.velocity * 4.5f), 0, 0, DustID.Smoke, 0f, 0f, 100, default, 2f);
private void SpawnState_OnStateBegin(StandState sender) { if (Owner.direction == -1) { Angle = (float)MathHelper.Pi; } }
private void Idle(StandState sender) { projectile.GetGlobal().HitRoadRollerInLifeTime = false; NonTimedAttack = false; HitNPCs.RemoveAll(x => !x.IsTimed); SpriteFX = Owner.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; projectile.Center = Vector2.SmoothStep(projectile.Center, Owner.Center + new Vector2(-30 * Owner.direction, -32), 0.18f); }
private void SignGrab_OnStateEnd(StandState sender) { stopSignHitCount = 3; projectile.width = 160; projectile.height = 160; GoIdle(sender); CurrentAnimation = "Stop_Idle0"; }
private void DespawnState_OnStateBegin(StandState sender) { if (Main.myPlayer == Owner.whoAmI) { TBARPlayer.Get(Owner).ScreenModifiers.RemoveAll(x => x is AerosmithScreenModifier || x is PlayerChaseScreenModifier); TBARPlayer.Get(Owner).ScreenModifiers.Add(new PlayerChaseScreenModifier(projectile.Center, Owner.Center, 0.2f)); } }
private void Idle(StandState sender) { ClearOnHitEffects(); NonTimedAttack = false; HitNPCs.RemoveAll(x => !x.IsTimed); SpriteFX = Owner.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; projectile.Center = Vector2.SmoothStep(projectile.Center, Owner.Center + new Vector2(-30 * Owner.direction, -32), 0.15f); }
private StandState() { if (_instance != null) { return; } _instance = this; }
private void EmeraldSplash_OnStateBegin(StandState sender) { emeraldSplashDirection = MousePosition; hasShot = false; attackDir = MousePosition.X < Owner.Center.X ? -1 : 1; Owner.direction = attackDir; SpriteFX = Owner.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; }
private void Despawn_OnStateEnd(StandState sender) { for (int i = 0; i < 100; i++) { Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.EmeraldBolt, 0, -3); } Main.PlaySound(SoundID.Shatter); projectile.Kill(); }
private void CutState_OnStateBegin(StandState sender) { OnHit += KingCrimsonProjectile_OnHit; NonTimedAttack = true; PunchStartPoint = Owner.Center; PunchDirection = PunchStartPoint.DirectTo(MousePosition, Owner.width + 16 * Range); projectile.damage = CutDamage; Owner.direction = MousePosition.X < Owner.Center.X ? -1 : 1; }
protected void BeginPunch(StandState sender) { PunchStartPoint = Owner.Center; Owner.direction = MousePosition.X < Owner.Center.X ? -1 : 1; PunchDirection = PunchStartPoint.DirectTo(MousePosition, Owner.width + 16 * Range); projectile.damage = GetPunchDamage(); }
private void Summon(StandState sender) { SpriteFX = Owner.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; if (Opacity < 1f) { Opacity += 0.05f; } projectile.Center = Vector2.SmoothStep(projectile.Center, Owner.Center + new Vector2(-30 * Owner.direction, -32), 0.15f); }
private void SlamDunkState_OnStateUpdate(StandState sender) { Owner.noFallDmg = true; if (MyRoller != null && MyRoller.modProjectile is RoadRollerProjectile roller && !roller.HasHitSomething) { projectile.Center = MyRoller.Center + new Vector2(60, -30); SpriteFX = SpriteEffects.None; Owner.direction = -1; Owner.Center = projectile.Center - new Vector2(0, 60); } }
private void FalconState_OnStateBegin(StandState sender) { NonTimedAttack = true; OnHit += MagicianRedProjectile_OnHit; PunchStartPoint = Owner.Center; Owner.direction = MousePosition.X < Owner.Center.X ? -1 : 1; PunchDirection = PunchStartPoint.DirectTo(MousePosition, Owner.width + 16 * Range); }
public override void InitializeStates(Projectile projectile) { string path = "Projectiles/Stands/Italy/Aerosmith/"; BaseDPS = -1; Speed = 4f; Opacity = -2f; IsEngineOn = true; // Wait, its all "Idle"? AddAnimation(ASStates.Spawn, path + "Idle", 18, 12); AddAnimation(ASStates.Idle, path + "Idle", 18, 12, true); AddAnimation(ASStates.Return, path + "Idle", 18, 12, true); AddAnimation(ASStates.Despawn, path + "Idle", 18, 12); AddAnimation(ASStates.Barrage, path + "Idle", 18, 12, true); // Always has been *cocks gun* StandState spawnState = AddState(ASStates.Spawn.ToString(), 90); spawnState.OnStateBegin += SpawnState_OnStateBegin; spawnState.OnStateUpdate += SpawnState_OnStateUpdate; spawnState.OnStateEnd += SpawnState_OnStateEnd; StandState idleState = AddState(ASStates.Idle.ToString()); idleState.OnStateUpdate += IdleState_OnStateUpdate; StandState despawnState = AddState(ASStates.Despawn.ToString(), 90); despawnState.OnStateUpdate += DespawnState_OnStateUpdate; despawnState.OnStateEnd += DespawnState_OnStateEnd; despawnState.OnStateBegin += DespawnState_OnStateBegin; StandState barrageState = AddState(ASStates.Barrage.ToString(), 12); barrageState.OnStateUpdate += IdleState_OnStateUpdate; barrageState.OnStateUpdate += BarrageState_OnStateUpdate; barrageState.OnStateEnd += BarrageState_OnStateEnd; StandState returnState = AddState(ASStates.Return.ToString()); returnState.OnStateUpdate += ReturnState_OnStateUpdate; returnState.OnStateBegin += DespawnState_OnStateBegin; SetState(ASStates.Spawn.ToString()); }
private void TwentyMeterSplash_OnStateUpdate(StandState sender) { var type = ModContent.ProjectileType <Tripwire>(); if (sender.TimeLeft % 12 == 0) { var x = 640; var y = 0; var xx = Main.rand.Next(0, 200); var yy = 0; var spawnOffset = twentyMeterSplashSpawnPoint - new Vector2(x, y).RotatedByRandom(MathHelper.TwoPi); var velocity = spawnOffset.DirectTo(twentyMeterSplashSpawnPoint + new Vector2(xx, yy).RotatedByRandom(MathHelper.TwoPi)); Projectile.NewProjectile(spawnOffset, velocity, type, EmeraldDamage, 0f, projectile.owner); } }
private void Summon_OnStateUpdate(StandState sender) { SpriteFX = Owner.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; if (Animations[CurrentAnimation].CurrentFrame == 11 && !cocoonBursted && CurrentAnimation == HieroAI.Summon + "1") { Main.PlaySound(SoundID.Shatter); cocoonBursted = true; for (int i = 0; i < 50; i++) { Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.EmeraldBolt, 0, -3); } } projectile.Center = Owner.Center + new Vector2(-30 * Owner.direction, -24); }
// Use this for initialization private void Start() { CharacterController = GetComponent <CharacterController>(); SkillManager = new SkillManager { Owner = this }; SkillManager.Init(); //_animator = transform.Find("Player").GetComponent<Animator>(); _animation = transform.GetChild(0).GetComponent <Animation>(); _standState = new StandState(this); _runState = new RunState(this); _deadState = new DeadState(this); _avatarState = _standState; }
private void SignAttack_OnStateEnd(StandState sender) { EndPunch(sender); stopSignHitCount--; if (stopSignHitCount <= 0) { projectile.width = 60; projectile.height = 60; } if (stopSignHitCount > 0) { CurrentAnimation = "Stop_Idle" + (3 - stopSignHitCount).ToString(); } }
public IronElement(Point pos, Logic model) { _model = model; Rect = new Rectangle(0, 0, ElementSize, ElementSize); SetPixelPositon(pos); StandState stand = new StandState(this, Properties.Resources.iron); DestroingState destroing = new DestroingState(this, _model, this); stand.transitions.Add(0, stand); stand.transitions.Add(1, destroing); State = stand; State.Direct = Direction.Right; }
public static void SendStandStateUpdate(Character character, StandState newState) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_STANDSTATE_UPDATE, 1)) { packet.Write((byte)newState); character.Client.Send(packet); } }