public BaseShoes(RobotAnimation Owner) : base(Owner) { CanLongJump = false; JumpTime = MaxJumpTime; DashCounter = 0; LastDashMovementInput = MovementInputs.None; }
public virtual void Update(GameTime gameTime, Dictionary <uint, RobotAnimation> DicRobot) { if (IsOnGround) { LastPositionOnGround = Position; } ActiveMovementStance = "None"; CurrentMovementInput = MovementInputs.None; InputManager.Update(gameTime); UpdateSkills(TripleThunderRobotRequirement.OnStepName); if (CollisionBetweenRobot) { UpdateRobotCollisionWithRobot(this, DicRobot); } if (!UpdateRobotCollisionWithWorld(this)) { Move(Speed); } CheckForWeaponDrop(); if (IsDynamic) { //Ground.X is always positive. if (NormalizedGroundVector.X < 0) { NormalizedGroundVector = -NormalizedGroundVector; } if (Speed.X > Friction) { Speed.X -= Friction; } else if (Speed.X < -Friction) { Speed.X += Friction; } else { Speed.X = 0; } Equipment.Update(gameTime); } base.Update(gameTime); }
public override void Load() { DicTimeline.Clear(); foreach (KeyValuePair <string, Timeline> Timeline in LoadTimelines(typeof(CoreTimeline))) { if (Timeline.Value is AnimationOriginTimeline) { continue; } DicTimeline.Add(Timeline.Key, Timeline.Value); } foreach (KeyValuePair <string, Timeline> Timeline in LoadTimelines(typeof(TripleThunderTimeline), this)) { DicTimeline.Add(Timeline.Key, Timeline.Value); } base.Load(); if (Content != null) { PrimaryWeapons.Load(Content); SecondaryWeapons.Load(Content); for (int W = 0; W < ListStanceAnimation.Count; ++W) { if (ListStanceAnimation[W].ActiveProjectileInfo != null && ListStanceAnimation[W].ActiveProjectileInfo.ProjectileAnimation.Path != string.Empty) { ListStanceAnimation[W].ActiveProjectileInfo.ProjectileAnimation.Load(Content, "Animations/Sprites/"); ListStanceAnimation[W].NozzleFlashAnimation.Load(Content, "Animations/Sprites/"); } if (ListStanceAnimation[W].ActiveProjectileInfo != null && ListStanceAnimation[W].ActiveProjectileInfo.TrailAnimation != null && ListStanceAnimation[W].ActiveProjectileInfo.TrailAnimation.Path != string.Empty) { ListStanceAnimation[W].ActiveProjectileInfo.TrailAnimation.Load(Content, "Animations/Sprites/"); } if (ListStanceAnimation[W].ExplosionAttributes.ExplosionAnimation.Path != string.Empty) { ListStanceAnimation[W].ExplosionAttributes.ExplosionAnimation.Load(Content, "Animations/Sprites/"); } } } SetAnimation(StandingAnimations.GetDefaultAnimationName()); CurrentMovementInput = MovementInputs.None; ActiveMovementStance = "None"; Update(new GameTime()); SetIdle(); }
private void Dash(MovementInputs MovementInput) { Owner.LockAnimation = true; LastDashMovementInput = MovementInputs.None; DashCounter = 0; if (MovementInput == MovementInputs.Right) { Owner.Speed = MaxWalkSpeed * Owner.NormalizedGroundVector * 2; } else if (MovementInput == MovementInputs.Left) { Owner.ActiveSpriteEffects = SpriteEffects.FlipHorizontally; Owner.Speed = -MaxWalkSpeed * Owner.NormalizedGroundVector * 2; } }
public static void Init() { player = new MovementInputs(); gun = new GunInputs(); SetupInputActionMap(gun.Gun); // TODO can we do this in a loop somehow? SetupInputActionMap(player.Player); SetupInputActionMap(player.Magazine); SetupInputActionMap(player.Inventory); gun.Enable(); player.Enable(); LoadOverrides(); SaveOverrides(); // Create an RInput object to hook into Unity's update cycle RInput instance = new GameObject().AddComponent <RInput>(); GameObject.DontDestroyOnLoad(instance); instance.gameObject.hideFlags = HideFlags.HideAndDontSave; }
public override void Move(MovementInputs MovementInput) { }
public override void Move(MovementInputs MovementInput) { Vector2 WalkSpeed = MaxWalkSpeed * Owner.NormalizedGroundVector; Owner.ActiveSpriteEffects = SpriteEffects.None; #region Move Right if (MovementInput == MovementInputs.Right) { if (Owner.NormalizedGroundVector.X > 0) { if (Owner.Speed.X < WalkSpeed.X) { Owner.Speed.X += Accel * Owner.NormalizedGroundVector.X; if (Owner.Speed.X > WalkSpeed.X) { Owner.Speed.X = MaxWalkSpeed * Owner.NormalizedGroundVector.X; } } } else if (Owner.NormalizedGroundVector.X < 0) { if (Owner.Speed.X > -WalkSpeed.X) { Owner.Speed.X += Accel * Owner.NormalizedGroundVector.X; if (Owner.Speed.X < WalkSpeed.X) { Owner.Speed.X = MaxWalkSpeed * Owner.NormalizedGroundVector.X; } } } if (Owner.NormalizedGroundVector.Y > 0) { if (Owner.Speed.Y < WalkSpeed.Y) { Owner.Speed.Y += Accel * Owner.NormalizedGroundVector.Y; if (Owner.Speed.Y > WalkSpeed.Y) { Owner.Speed.Y = MaxWalkSpeed * Owner.NormalizedGroundVector.Y; } } } else if (Owner.NormalizedGroundVector.Y < 0) { if (Owner.Speed.Y > -WalkSpeed.Y) { Owner.Speed.Y += Accel * Owner.NormalizedGroundVector.Y; if (Owner.Speed.Y < WalkSpeed.Y) { Owner.Speed.Y = MaxWalkSpeed * Owner.NormalizedGroundVector.Y; } } } } #endregion #region Move Left else if (MovementInput == MovementInputs.Left) { Owner.ActiveSpriteEffects = SpriteEffects.FlipHorizontally; if (Owner.NormalizedGroundVector.X > 0) { if (Owner.Speed.X > -WalkSpeed.X) { Owner.Speed.X -= Accel * Owner.NormalizedGroundVector.X; if (Owner.Speed.X < WalkSpeed.X) { Owner.Speed.X = -MaxWalkSpeed * Owner.NormalizedGroundVector.X; } } } else if (Owner.NormalizedGroundVector.X < 0) { if (Owner.Speed.X < WalkSpeed.X) { Owner.Speed.X -= Accel * Owner.NormalizedGroundVector.X; if (Owner.Speed.X > WalkSpeed.X) { Owner.Speed.X = -MaxWalkSpeed * Owner.NormalizedGroundVector.X; } } } if (Owner.NormalizedGroundVector.Y > 0) { if (Owner.Speed.Y > -WalkSpeed.Y) { Owner.Speed.Y -= Accel * Owner.NormalizedGroundVector.Y; if (Owner.Speed.Y < WalkSpeed.Y) { Owner.Speed.Y = -MaxWalkSpeed * Owner.NormalizedGroundVector.Y; } } } else if (Owner.NormalizedGroundVector.Y < 0) { if (Owner.Speed.Y < WalkSpeed.Y) { Owner.Speed.Y -= Accel * Owner.NormalizedGroundVector.Y; if (Owner.Speed.Y > WalkSpeed.Y) { Owner.Speed.Y = -MaxWalkSpeed * Owner.NormalizedGroundVector.Y; } } } } #endregion if (DashCounter > 0 && LastDashMovementInput == MovementInput) { Dash(MovementInput); } else { if (LastDashMovementInput != MovementInput) { DashCounter = 0; } LastDashMovementInput = MovementInput; } Owner.ActiveMovementStance = "Moving"; Owner.CurrentMovementInput = MovementInput; }
public InputChoice(AttackInputs AttackInput, MovementInputs MovementInput) { this.AttackInput = AttackInput; this.MovementInput = MovementInput; NextInputDelay = 0; }
public override bool InitiateAttack(GameTime gameTime, AttackInputs AttackInput, MovementInputs CurrentMovementInput, string ActiveMovementStance, bool ForceCombo, RobotAnimation Owner) { if (!IsShootingNext) { if (_IsShooting) { IsShootingNext = CurrentAnimation.ActiveKeyFrame >= CurrentAnimation.LoopEnd - 1; if (InstantActivation) { InitiateFollowingAttack(AnimationType == AnimationTypes.PartialAnimation, ActiveMovementStance, Owner); return(true); } } //First use of a combo, use it immediatly. else { IsShootingNext = true; _IsShooting = true; InitiateFollowingAttack(AnimationType == AnimationTypes.PartialAnimation, ActiveMovementStance, Owner); return(true); } } return(false); }
public abstract void Move(MovementInputs MovementInput);
/// <summary> /// /// </summary> /// <param name="gameTime"></param> /// <param name="AttackInput"></param> /// <param name="ActiveWeapon"></param> /// <returns>Returns true if the attack was used.</returns> public abstract bool InitiateAttack(GameTime gameTime, AttackInputs AttackInput, MovementInputs CurrentMovementInput, string ActiveMovementStance, bool ForceCombo, RobotAnimation Owner);
public override bool InitiateAttack(GameTime gameTime, AttackInputs AttackInput, MovementInputs CurrentMovementInput, string ActiveMovementStance, bool ForceCombo, RobotAnimation Owner) { //Only get the next combo if it is not set to avoid overriding it. if (NextCombo == null) { // Already using a combo, fetch the next combo. if (ActiveCombo != null) { NextCombo = ActiveCombo.GetNextCombo(AttackInput, CurrentMovementInput, gameTime, ForceCombo, Owner); if (NextCombo != null && NextCombo.InstantActivation) { InitiateFollowingAttack(NextCombo.AnimationType == AnimationTypes.PartialAnimation, ActiveMovementStance, Owner); } } //First use of a combo, use it immediatly. else { Combo ActiveWeaponCombo = GetActiveWeaponCombo(ActiveMovementStance); if (ActiveWeaponCombo != null) { NextCombo = ActiveWeaponCombo.GetNextCombo(AttackInput, CurrentMovementInput, gameTime, ForceCombo, Owner); if (NextCombo != null) { ActiveCombo = ActiveWeaponCombo; InitiateFollowingAttack(NextCombo.AnimationType == AnimationTypes.PartialAnimation, ActiveMovementStance, Owner); return(true); } } } } return(false); }
public void Jump() { CurrentMovementInput = MovementInputs.Up; Equipment.OnJump(); }
public override void Load(BinaryReader BR) { base.Load(BR); _MovementInput = (MovementInputs)BR.ReadByte(); }
public Combo GetNextCombo(AttackInputs CurrentAttackInput, MovementInputs CurrentMovementInput, GameTime gameTime, bool ForceCombo, RobotAnimation Owner) { for (int C = 0; C < ListNextCombo.Count; C++) { bool InputComplete = ForceCombo; InputChoice ActiveInputChoice = ListNextCombo[C].ListInputChoice[ListNextCombo[C].CurrentInputIndex]; bool AttackInputAccepted = false; if (ActiveInputChoice.AttackInput != AttackInputs.None && (ActiveInputChoice.AttackInput == AttackInputs.AnyHold || ActiveInputChoice.AttackInput == AttackInputs.AnyPress || ActiveInputChoice.AttackInput == CurrentAttackInput)) { AttackInputAccepted = true; } bool MovementInputAccepted = false; if (ActiveInputChoice.MovementInput == MovementInputs.Any || ActiveInputChoice.MovementInput == CurrentMovementInput) { MovementInputAccepted = true; } bool NextInputDelayAccepted = false; if (ActiveInputChoice.CurrentDelay >= ActiveInputChoice.NextInputDelay) { NextInputDelayAccepted = true; } else { ActiveInputChoice.CurrentDelay += gameTime.ElapsedGameTime.Milliseconds; } bool FrameLimitAccepted = false; int ComboKeyFrame = Owner.ActiveKeyFrame; if (AnimationType == AnimationTypes.PartialAnimation) { int a = Owner.GetPartialAnimationKeyFrame(AnimationName); if (a >= 0) { ComboKeyFrame = a; } } if (ComboKeyFrame >= ListStart[C] && ComboKeyFrame <= ListEnd[C]) { FrameLimitAccepted = true; } if (AttackInputAccepted && MovementInputAccepted && NextInputDelayAccepted && FrameLimitAccepted) { ListNextCombo[C].CurrentInputIndex++; if (ListNextCombo[C].CurrentInputIndex >= ListNextCombo[C].ListInputChoice.Count) { InputComplete = true; } } if (InputComplete) { ListNextCombo[C].Reset(); return(ListNextCombo[C]); } } return(null); }