public LaydownState(bool conCurrentCanRun, ref IRangedCombatLogic control, ERangedAttackID currentID, ref IInvertoryLogic invertoryLogic) { this.conCurrentCanRun = conCurrentCanRun; this.control = control; this.currenStateID = currentID; this.invertoryLogic = invertoryLogic; }
public ShootState(bool canConcurentRun, ERangedAttackID currentStateID, ref IRangedCombatLogic control, ref Animator animator, ref IInvertoryLogic invertoryLogic) { this.canConcurentRun = canConcurentRun; this.currentStateID = currentStateID; this.control = control; this.animator = animator; this.invertoryLogic = invertoryLogic; }
// TODO: weapon Invertory current weapon ref InvertoryWeapons public ReloadState(bool conCurrentCanRun, ref IRangedCombatLogic control, ERangedAttackID currentID, ref IInvertoryLogic invertoryLogic, ref Animator animator) { this.conCurrentCanRun = conCurrentCanRun; this.control = control; this.currentID = currentID; this.invertoryLogic = invertoryLogic; this.animator = animator; }
public HoldState(bool canConcurrentRun, ref IRangedCombatLogic control, ERangedAttackID currentID, ref IHoldWeapon holdWeaponInfo, ref Animator animator, ref IInvertoryLogic invertoryLogic) { this.canConcurrentRun = canConcurrentRun; this.control = control; this.currentID = currentID; this.animator = animator; this.holdWeaponInfo = holdWeaponInfo; this.invertoryLogic = invertoryLogic; }
// Use this for initialization void Start() { ICameraData camData = userCamera.GetComponent <ICameraData>(); spCamera = camData.SpCamera; invertoryLogic = GetComponent <IInvertoryData>().InvertoryLogic; Transform follow = transform; CharacterController characterController = GetComponent <CharacterController>(); characterControl = new SpacemarineMove(ref characterController, ref follow, collideWith); movementInput = new SpMovementAndMeleeCombat(ref rayCastFrom, collideWith, ref characterController); movementLogic = new SpMovementAndMeleeLogic(movementInput); rangedInput = new RangedCombatInput(); rangedLogic = new RangedCombatLogic(ref rangedInput, spCamera.CameraTransform); spaceMove = new ControlSpMovement(ref movementLogic, ref characterControl, ref characterAnimator, ref rangedLogic, ref invertoryLogic, ref spCamera); }
public ControlSpMovement(ref IMovementAndMeleeCombatLogic input, ref IMove characterController , ref Animator animator, ref IRangedCombatLogic rangedLogic, ref IInvertoryLogic invertoryLogic, ref ISpCameraFollow camera) { this.rangedInput = rangedLogic; this.rangedInput.InputChanged += RangedInput_InputChanged; this.invertoryInput = invertoryLogic; this.spCamera = camera; // Movement FSM setup this.movementAndMeleeControl = input; this.fSMSpMovement = new FSMachineSpacemarineMove(EMovementID.Walking, ref this.movementAndMeleeControl, true); WalkState walkState = new WalkState(true, 2.0f, ref characterController, ref this.movementAndMeleeControl, EMovementID.Walking, ref animator); RunState runState = new RunState(false, 5.0f, ref characterController, ref this.movementAndMeleeControl, EMovementID.Running, ref animator); SmashState smashState = new SmashState(false, 6.0f, 1.25f, ref characterController, ref this.movementAndMeleeControl, EMovementID.Smashing, ref animator); FallState fallState = new FallState(2.0f, -Physics.gravity.y * Vector3.down, true, ref characterController, ref this.movementAndMeleeControl, EMovementID.Falling, ref animator); LandState landState = new LandState(0.75f, false, ref input, ref characterController, EMovementID.Landing); this.fSMSpMovement.AddState(walkState); this.fSMSpMovement.AddState(runState); this.fSMSpMovement.AddState(smashState); this.fSMSpMovement.AddState(fallState); this.fSMSpMovement.AddState(landState); this.fSMSpMovement.SetDefaultState(walkState); this.fSMSpMovement.StateChanged += FSMSpMovement_StateChanged; // Melee FSM machine setup AttackState attackState = new AttackState(false, EMeleeAttackID.Attacking, ref this.movementAndMeleeControl, ref invertoryLogic, ref animator); MeleeIdle meleeIdle = new MeleeIdle(true, EMeleeAttackID.Idle, ref this.movementAndMeleeControl); this.fSMSpCombat = new FSMCombatSpacemarine(true, EMeleeAttackID.Idle, ref this.movementAndMeleeControl, ref invertoryLogic); this.fSMSpCombat.AddState(attackState); this.fSMSpCombat.AddState(meleeIdle); this.fSMSpCombat.SetDefaultState(meleeIdle); //Ranged FSM setup IHoldWeapon holdWeaponInfo = new HoldPistol(5.0f); IRangedState holdState = new HoldState(true, ref rangedLogic, ERangedAttackID.Hold, ref holdWeaponInfo, ref animator, ref invertoryInput); IRangedShootState shootState = new ShootState(true, ERangedAttackID.Shoot, ref rangedLogic, ref animator, ref invertoryLogic); IRangedState reloadState = new ReloadState(true, ref rangedLogic, ERangedAttackID.Reload, ref invertoryLogic, ref animator); IRangedState laydownState = new LaydownState(true, ref rangedLogic, ERangedAttackID.LayDown, ref invertoryLogic); this.fSMSpRangedCombat = new FSMRangedSpacemarine(true, ERangedAttackID.LayDown, ref rangedLogic, ref invertoryLogic); this.fSMSpRangedCombat.AddState(holdState); this.fSMSpRangedCombat.AddState(reloadState); this.fSMSpRangedCombat.AddState(shootState); this.fSMSpRangedCombat.AddState(laydownState); this.fSMSpRangedCombat.SetDefaultState(laydownState); this.fSMSpRangedCombat.StateChanged += FSMSpRangedCombat_StateChanged; // Invertory Setup InvertoryIdle invertoryIdleState = new InvertoryIdle(true, ref invertoryLogic); InvertorySwitch invertorySwitchState = new InvertorySwitch(true, ref invertoryLogic, ref animator); this.fSMInvertory = new FSMInvertory(EInvertoryStateID.None, ref invertoryLogic); this.fSMInvertory.AddState(invertoryIdleState); this.fSMInvertory.AddState(invertorySwitchState); this.fSMInvertory.SetDefaultState(invertoryIdleState); this.fSMInvertory.StateChanged += FSMInvertory_StateChanged; if (invertoryLogic.HasInputModel) { this.spCamera.ObjectRotator.CanRotate = !invertoryLogic.InputInfo.CurrentWeapons.IsMeleeEquipment; this.spCamera.IsMeleeViewEnabled = !invertoryLogic.InputInfo.CurrentWeapons.IsMeleeEquipment; } else { this.spCamera.IsMeleeViewEnabled = false; } }