public override void Enter() { base.Enter(); var throwDirection = -ThrowPoint.Value.up; MeatClumpController clump = Instantiate(MeatClumpPrefab); clump.transform.position = ThrowPoint.Value.position; clump.SetMoving(ThrowSpeed.Value, throwDirection); playerController.OnClumpThrown(throwDirection, true); }
public override void Enter() { base.Enter(); comboTimer.RestartTimer(); comboFinishTimer.RestartTimer(); Vector3 throwDirection; var aimTarget = CurrentTargetRef.Value; //If no target, throw forward if (aimTarget.SafeIsUnityNull()) { throwDirection = GetMoveDirection().normalized; } //If find collider, target center bounds, otherwise target transform. else { Collider targetCollider = aimTarget.GetComponent <Collider>(); Vector3 targetPosition; if (targetCollider != null) { targetPosition = targetCollider.bounds.center; } else { targetPosition = aimTarget.position; } throwDirection = (targetPosition - FirePoint.Value.position).normalized; } if (Mathf.Approximately(throwDirection.magnitude, 0)) { throwDirection = FirePoint.Value.forward; } MeatClumpController clump = Instantiate(MeatClumpPrefab); clump.transform.position = FirePoint.Value.position; clump.SetMoving(ThrowSpeed.Value, throwDirection); if (ClumpOverCharged.Value) { clump.SetOverCharged(); } playerController.OnClumpThrown(throwDirection); }