public CharacterStateMachine(InputModel inputModel, CharacterModel characterModel, CharacterAnimationController animationController) { _inputModel = inputModel; _characterModel = characterModel; _animationController = animationController; _allStates = new List <CharacterBaseState>(); PreviousState = null; CurrentState = null; _defaultIdleState = (DefaultIdleState)CreateState(new DefaultIdleState(_characterModel, _inputModel, _animationController, this)); _battleIdleState = (BattleIdleState)CreateState(new BattleIdleState(_characterModel, _inputModel, _animationController, this)); _defaultMovementState = (DefaultMovementState)CreateState(new DefaultMovementState(_characterModel, _inputModel, _animationController, this)); _battleMovementState = (BattleMovementState)CreateState(new BattleMovementState(_characterModel, _inputModel, _animationController, this)); _battleTargetMovementState = (BattleTargetMovementState)CreateState(new BattleTargetMovementState(_characterModel, _inputModel, _animationController, this)); _attackingLeftState = (AttackingFromLeftState)CreateState(new AttackingFromLeftState(_characterModel, _inputModel, _animationController, this)); _attackingRightState = (AttackingFromRightState)CreateState(new AttackingFromRightState(_characterModel, _inputModel, _animationController, this)); _jumpingState = (JumpingState)CreateState(new JumpingState(_characterModel, _inputModel, _animationController, this)); _dodgingState = (DodgingState)CreateState(new DodgingState(_characterModel, _inputModel, _animationController, this)); _fallingState = (FallingState)CreateState(new FallingState(_characterModel, _inputModel, _animationController, this)); _dancingState = (DancingState)CreateState(new DancingState(_characterModel, _inputModel, _animationController, this)); _rollingState = (RollingState)CreateState(new RollingState(_characterModel, _inputModel, _animationController, this)); _rollingTargetState = (RollingTargetState)CreateState(new RollingTargetState(_characterModel, _inputModel, _animationController, this)); _landingState = (LandingState)CreateState(new LandingState(_characterModel, _inputModel, _animationController, this)); _fallOnGroundState = (FallOnGroundState)CreateState(new FallOnGroundState(_characterModel, _inputModel, _animationController, this)); _stunnedState = (StunnedState)CreateState(new StunnedState(_characterModel, _inputModel, _animationController, this)); _talkingState = (TalkingState)CreateState(new TalkingState(_characterModel, _inputModel, _animationController, this)); _deadState = (DeadState)CreateState(new DeadState(_characterModel, _inputModel, _animationController, this)); _gettingWeaponState = (GettingWeaponState)CreateState(new GettingWeaponState(_characterModel, _inputModel, _animationController, this)); _removingWeaponState = (RemovingWeaponState)CreateState(new RemovingWeaponState(_characterModel, _inputModel, _animationController, this)); }
public TalkingState(CharacterModel characterModel, InputModel inputModel, CharacterAnimationController animationController, CharacterStateMachine stateMachine) : base(characterModel, inputModel, animationController, stateMachine) { Type = StateType.NotActive; IsTargeting = false; IsAttacking = false; CanExit = false; CanBeOverriden = false; }
public RollingState(CharacterModel characterModel, InputModel inputModel, CharacterAnimationController animationController, CharacterStateMachine stateMachine) : base(characterModel, inputModel, animationController, stateMachine) { Type = StateType.Battle; IsTargeting = false; IsAttacking = false; CanExit = false; CanBeOverriden = false; CameraTransform = Services.SharedInstance.CameraService.CharacterCamera.transform; }
public JumpingState(CharacterModel characterModel, InputModel inputModel, CharacterAnimationController animationController, CharacterStateMachine stateMachine) : base(characterModel, inputModel, animationController, stateMachine) { Type = StateType.Default; IsTargeting = false; IsAttacking = false; CanExit = false; CanBeOverriden = true; JumpVerticalForce = _characterModel.CharacterCommonSettings.JumpVerticalForce; JumpHorizontalForce = _characterModel.CharacterCommonSettings.JumpHorizontalForce; }
public void OnAwake() { Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; _characterModel = _context.CharacterModel; _animationController = new CharacterAnimationController(_characterModel.CharacterAnimator); _speedCountFrame = _characterModel.CharacterCommonSettings.SpeedMeasureFrame; _lastPosition = _characterModel.CharacterTransform.position; _currentPosition = _lastPosition; _currentHealth = _characterModel.CharacterCommonSettings.HealthPoints; _currentBattleIgnoreTime = 0; _stateMachine = new CharacterStateMachine(_inputModel, _characterModel, _animationController); _stateMachine.SetStartState(_stateMachine._defaultIdleState); _inputModel.OnJump += SetJumpingState; _inputModel.OnBattleExit += ExitBattle; _inputModel.OnTargetLock += ChangeTargetMode; _inputModel.OnAttackLeft += SetAttackingLeftState; _inputModel.OnAttackRight += SetAttackingRightState; _inputModel.OnDance += ChangeDancingState; _characterModel.PlayerBehavior.OnFilterHandler += OnFilterHandler; _characterModel.PlayerBehavior.OnTriggerEnterHandler += OnTriggerEnterHandler; _characterModel.PlayerBehavior.OnTriggerExitHandler += OnTriggerExitHandler; _characterModel.PlayerBehavior.OnTakeDamageHandler += TakeDamage; _stateMachine.OnStateChangeHandler += OnStateChange; LockCharAction.LockCharacterMovement += SetTalkingState; SetRightWeapon(_services.InventoryService.GetAllWeapons()[0]); //SetLeftWeapon(_services.InventoryService.Feast); //SetRightWeapon(_services.InventoryService.Feast); _services.InventoryService.HideWepons(_characterModel); }
public AttackingFromLeftState(CharacterModel characterModel, InputModel inputModel, CharacterAnimationController animationController, CharacterStateMachine stateMachine) : base(characterModel, inputModel, animationController, stateMachine) { Type = StateType.Battle; IsTargeting = false; IsAttacking = true; CanExit = false; CanBeOverriden = false; _currentAttackIndex = 0; }
public BattleTargetMovementState(CharacterModel characterModel, InputModel inputModel, CharacterAnimationController animationController, CharacterStateMachine stateMachine) : base(characterModel, inputModel, animationController, stateMachine) { Type = StateType.Battle; IsTargeting = true; IsAttacking = false; CanExit = false; CanBeOverriden = true; SpeedIncreace = _characterModel.CharacterCommonSettings.InBattleRunSpeed / _characterModel.CharacterCommonSettings.InBattleWalkSpeed; }
public RemovingWeaponState(CharacterModel characterModel, InputModel inputModel, CharacterAnimationController animationController, CharacterStateMachine stateMachine) : base(characterModel, inputModel, animationController, stateMachine) { Type = StateType.Default; IsTargeting = false; IsAttacking = false; CanExit = false; CanBeOverriden = false; }