GameVsJam/3d Prototyp/Assets/Scripts/Interaction/VendingMachine.cs

24 lines
575 B
C#

using System.Collections;
using System.Collections.Generic;
using Interaction;
using UnityEngine;
public class VendingMachine : MonoBehaviour
{
[SerializeField]
private PickupInteractible _pizzaPrefab;
[SerializeField]
private Transform _pizzaChute;
[SerializeField]
private float _shootForce;
public void DropPiza()
{
PickupInteractible pizza = Instantiate(_pizzaPrefab, _pizzaChute.position, _pizzaChute.rotation);
pizza.GetComponent<Rigidbody>().AddForce(new Vector3(0, 0, _shootForce), ForceMode.Impulse);
}
}