示例#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>();
 }