예제 #1
0
 public CrouchState(Enum stateID, PlayerEntry playerEntry) : base(stateID, playerEntry.StateMachine)
 {
     _animator            = playerEntry.GetComponent <Animator>();
     _optionBoxCollider2D = playerEntry.GetComponent <BoxCollider2D>();
     _rigidbody2D         = playerEntry.GetComponent <Rigidbody2D>();
     _headPoint           = playerEntry.headPoint;
     _layerMask           = playerEntry.layerMask;
 }
예제 #2
0
 public IdleState(Enum stateID, PlayerEntry playerEntry) : base(stateID, playerEntry.StateMachine)
 {
     _animator  = playerEntry.GetComponent <Animator>();
     _transform = playerEntry.transform;
     // 玩家精灵边框的大小
     _playerSize = playerEntry.GetComponent <SpriteRenderer>().bounds.size;
     // 碰撞检测盒子的大小,使用玩家的大小 40%,同时高度设置为 0.5
     _boxSize   = new Vector2(_playerSize.x * 0.4f, PlayerVariables.BoxHeight);
     _layerMask = playerEntry.layerMask;
 }
예제 #3
0
 public HurtState(Enum stateID, PlayerEntry playerEntry) : base(stateID, playerEntry.StateMachine)
 {
     _animator        = playerEntry.GetComponent <Animator>();
     _rigidbody2D     = playerEntry.GetComponent <Rigidbody2D>();
     _hurtAudioSource = playerEntry.hurtAudioSource;
 }
예제 #4
0
 public DeathState(Enum stateID, PlayerEntry playerEntry) : base(stateID, playerEntry.StateMachine)
 {
     _audioSource = playerEntry.GetComponent <AudioSource>();
 }