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; }
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; }
public HurtState(Enum stateID, PlayerEntry playerEntry) : base(stateID, playerEntry.StateMachine) { _animator = playerEntry.GetComponent <Animator>(); _rigidbody2D = playerEntry.GetComponent <Rigidbody2D>(); _hurtAudioSource = playerEntry.hurtAudioSource; }
public DeathState(Enum stateID, PlayerEntry playerEntry) : base(stateID, playerEntry.StateMachine) { _audioSource = playerEntry.GetComponent <AudioSource>(); }