init
This commit is contained in:
commit
27755409e3
195 changed files with 146336 additions and 0 deletions
28
Assets/Scripts/StartGame.cs
Normal file
28
Assets/Scripts/StartGame.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class StartGame : MonoBehaviour{
|
||||
|
||||
[SerializeField] float force = 5f, forceOffset = .5f;
|
||||
Rigidbody rb;
|
||||
|
||||
bool started;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Awake(){
|
||||
rb = GetComponent<Rigidbody>();
|
||||
}
|
||||
|
||||
void Update(){
|
||||
if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.P))
|
||||
Play();
|
||||
}
|
||||
|
||||
public void Play(){
|
||||
if (started) return;
|
||||
rb.AddForceAtPosition(transform.forward * force, transform.position + transform.up * forceOffset, ForceMode.Impulse);
|
||||
FindObjectOfType<ObjectPlacer>().playing = true;
|
||||
started = true;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue