public void SetSkillPalette(BipedSkillPalette skillPalette) { mSkillPalette = skillPalette; if (mSkillPalette != null && mBipedControl == null) { mBipedControl.Owner.ActorDespawning += ActorDespawningHandler; } }
public TPBipedPaletteInputProcessor(PlayerIndex inputIndex) : base(inputIndex) { mBipedControl = null; mSkillPalette = null; mSkillActions = new BinaryControlActions[6]; mSkillActions[0] = BinaryControlActions.Skill1; mSkillActions[1] = BinaryControlActions.Skill2; mSkillActions[2] = BinaryControlActions.Skill3; mSkillActions[3] = BinaryControlActions.Skill4; mSkillActions[4] = BinaryControlActions.Skill5; mSkillActions[5] = BinaryControlActions.Skill6; }
public override void AssignAvatar(int actorId) { base.AssignAvatar(actorId); PlayerIndex inputIndex = GameResources.PlaySession.LocalPlayers[PlayerId]; Actor avatar = GameResources.ActorManager.GetActorById(ActorId); BipedControllerComponent bipedControl = avatar.GetComponent <BipedControllerComponent>(ActorComponent.ComponentType.Control); bipedControl.AimCheck = delegate() { return(mInputMode == InputMode.Aiming); }; // Begin InputProcessors configuration: // Biped, aloof mode: TPBipedFixedControlsInputProcessor bipedProc; if (mInputProcs[(int)(InputMode.Aloof)].ContainsKey(typeof(TPBipedFixedControlsInputProcessor))) { bipedProc = (TPBipedFixedControlsInputProcessor)(mInputProcs[(int)(InputMode.Aloof)][typeof(TPBipedFixedControlsInputProcessor)]); } else { bipedProc = new TPBipedFixedControlsInputProcessor(inputIndex, mCamera); mInputProcs[(int)(InputMode.Aloof)].Add(typeof(TPBipedFixedControlsInputProcessor), bipedProc); } bipedProc.ActiveInputMap = mPlayerInputMap; bipedProc.SetControllerComponent(bipedControl); // Biped, aiming mode: TPAimingBipedMovementInputProcessor aimingBipedProc; if (mInputProcs[(int)(InputMode.Aiming)].ContainsKey(typeof(TPAimingBipedMovementInputProcessor))) { aimingBipedProc = (TPAimingBipedMovementInputProcessor)(mInputProcs[(int)(InputMode.Aiming)][typeof(TPAimingBipedMovementInputProcessor)]); } else { aimingBipedProc = new TPAimingBipedMovementInputProcessor(inputIndex); mInputProcs[(int)(InputMode.Aiming)].Add(typeof(TPAimingBipedMovementInputProcessor), aimingBipedProc); } aimingBipedProc.ActiveInputMap = mPlayerInputMap; aimingBipedProc.SetControllerComponent(bipedControl); // Skill palette, shared between aiming and aloof modes: TPBipedPaletteInputProcessor paletteProc; if (mInputProcs[(int)(InputMode.Aloof)].ContainsKey(typeof(TPBipedPaletteInputProcessor))) { paletteProc = (TPBipedPaletteInputProcessor)(mInputProcs[(int)(InputMode.Aloof)][typeof(TPBipedPaletteInputProcessor)]); } else { paletteProc = new TPBipedPaletteInputProcessor(inputIndex); mInputProcs[(int)(InputMode.Aloof)].Add(typeof(TPBipedPaletteInputProcessor), paletteProc); } if (!(mInputProcs[(int)(InputMode.Aiming)].ContainsKey(typeof(TPBipedPaletteInputProcessor)))) { mInputProcs[(int)(InputMode.Aiming)].Add(typeof(TPBipedPaletteInputProcessor), paletteProc); } paletteProc.ActiveInputMap = mPlayerInputMap; paletteProc.SetControllerComponent(bipedControl); BipedSkillPalette skillPalette = avatar.GetBehaviorThatImplementsType <BipedSkillPalette>(); paletteProc.SetSkillPalette(skillPalette); // Camera, aloof mode: TPCameraInputProcessor camera; if (mInputProcs[(int)(InputMode.Aloof)].ContainsKey(typeof(TPCameraInputProcessor))) { camera = (TPCameraInputProcessor)(mInputProcs[(int)(InputMode.Aloof)][typeof(TPCameraInputProcessor)]); } else { camera = new TPCameraInputProcessor(inputIndex, mMmoCameraDesc); mInputProcs[(int)(InputMode.Aloof)].Add(typeof(TPCameraInputProcessor), camera); } camera.ActiveInputMap = mPlayerInputMap; // Done with InputProcessor configuration. // Reset camera placement: mMmoCameraDesc.Distance = 38.0f; mMmoCameraDesc.Pitch = -MathHelper.Pi / 6.0f; // Positive pitch will move the camera -Y since it's on the +Z side mMmoCameraDesc.Yaw = 0.0f; DynamicCollisionComponent dcc = avatar.GetComponent <DynamicCollisionComponent>(ActorComponent.ComponentType.Physics); mAvatarBepuEntity = dcc.Entity; }
private void ActorDespawningHandler(object sender, EventArgs e) { mBipedControl = null; mSkillPalette = null; }
public void SetSkillPalette(BipedSkillPalette skillPalette) { mSkillPalette = skillPalette; if (mSkillPalette != null && mBipedControl == null) mBipedControl.Owner.ActorDespawning += ActorDespawningHandler; }