18 lines
644 B
C#
18 lines
644 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class Launch : MonoBehaviour {
|
||
|
|
||
|
[SerializeField] GameObject tambourine;
|
||
|
|
||
|
[SerializeField] private float horizSpeed;
|
||
|
[SerializeField] private float vertSpeed;
|
||
|
|
||
|
public void ThrowTambourine(int facing) {
|
||
|
GameObject newTambourine = Instantiate(tambourine, this.gameObject.transform.position, this.gameObject.transform.rotation);
|
||
|
// multiply horizSpeed by facing if not using moving launch point
|
||
|
newTambourine.GetComponent<Rigidbody2D>().AddForce(new Vector2(horizSpeed * facing, vertSpeed), ForceMode2D.Impulse);
|
||
|
}
|
||
|
}
|