Commit changes to player controller and object.
This commit is contained in:
parent
2a295d76cd
commit
e8c5eec9ce
2 changed files with 155 additions and 11 deletions
|
|
@ -7,6 +7,7 @@ public class PlayerController : MonoBehaviour {
|
|||
public float nextFire;
|
||||
public float fireRate;
|
||||
public GameObject shank;
|
||||
public Transform playerAngle;
|
||||
public Transform shankSpawn;
|
||||
|
||||
void Update()
|
||||
|
|
@ -14,7 +15,7 @@ public class PlayerController : MonoBehaviour {
|
|||
if (Input.GetButton("Fire1") && Time.time > nextFire)
|
||||
{
|
||||
nextFire = Time.time + fireRate;
|
||||
Instantiate(shank, shankSpawn.position, rigidbody.rotation);
|
||||
Instantiate(shank, shankSpawn.position, playerAngle.rotation);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -23,13 +24,13 @@ public class PlayerController : MonoBehaviour {
|
|||
float moveVertical = Input.GetAxis ("Vertical");
|
||||
|
||||
if (moveHorizontal < 0)
|
||||
transform.eulerAngles = new Vector3(45f, -180f, 0f);
|
||||
else if (moveHorizontal > 0)// transform.RotateAround(Vector3.zero, Vector3.up, 0f);
|
||||
transform.eulerAngles = new Vector3(45f, 0f, 0f);
|
||||
playerAngle.eulerAngles = new Vector3(0f, -180f, 0f);
|
||||
else if (moveHorizontal > 0)
|
||||
playerAngle.eulerAngles = new Vector3(0f, 0f, 0f);
|
||||
else if (moveVertical < 0)
|
||||
transform.eulerAngles = new Vector3(45f, -270f, 0f);
|
||||
playerAngle.eulerAngles = new Vector3(0f, -270f, 0f);
|
||||
else if (moveVertical > 0)
|
||||
transform.eulerAngles = new Vector3(45f, -90f, 0f);
|
||||
playerAngle.eulerAngles = new Vector3(0f, -90f, 0f);
|
||||
|
||||
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue