public override void OnStart() { _animator.SetTrigger(_attackAnimHash); _animationCallback.InitEvent(null, delegate { Object.Instantiate(_piranhaController._bulletPrefab, _shootOffset.position, _shootOffset.rotation); }); _duration = 0.0f; }
public override void OnStart() { _animationCallback.InitEvent(null, () => { //Debug.Log("ANimatino END"); _stateMachine.ChangeState <PlayerIdleState>(); }); _animator.SetTrigger(_animHurtTrigger); Vector2 reverseVec = UtilMethods.DegreeToVector2(60.0f); reverseVec.x *= _owner.FacingRight ? -1.0f : 1.0f; reverseVec.y *= 1.5f; _rigidbody.velocity = Vector2.zero; _rigidbody.AddForce(reverseVec * _owner.ReactionPower); }
public override void OnStart() { _animationCallback.InitEvent(null, () => { if (_owner._playerData.Life == 0) { GameManager.Instance.GameOver(); return; } Object.Destroy(_owner.gameObject); GameManager.Instance.PlayerDied(); RespawnManager.Instance.RespawnPlayer(); }); _rigidbody.velocity = Vector2.zero; _rigidbody.bodyType = RigidbodyType2D.Kinematic; _collider.enabled = false; _animator.SetTrigger(_animDeadTrigger); }