1
0
Fork 0
crew-of-one/Assets/Scripts/ship-controls/aftThrusters.cs
Ava Gaiety Wroten 0cc43d7fb3 Initial Commit
2020-07-30 13:17:01 -05:00

30 lines
569 B
C#

using System.Collections;
using UnityEngine;
public class aftThrusters : MonoBehaviour
{
public float horizontalInputAxis = 0;
GameObject ship;
bool down = false;
void Start()
{
ship = GameObject.FindWithTag("ship");
}
void OnMouseOver()
{
if (Input.GetMouseButtonDown(0)) down = true;
if (Input.GetMouseButtonUp(0)) down = false;
}
void OnMouseExit()
{
down = false;
}
void Update()
{
if (down) ship.GetComponent<ship>().AftThrusters(horizontalInputAxis);
}
}