-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding PCSpawner to correct branch #4
base: player-spawning-and-placement
Are you sure you want to change the base?
Changes from all commits
0ba8553
7fceb5a
5d28054
aef3604
09dc0c6
51a7beb
97c447c
c88a816
a86d4b8
ccdcc5e
1792c5e
33caba8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
|
||
public class PCSpawner : MonoBehaviour { | ||
|
||
public Transform player; | ||
private GameObject playerObject; | ||
private PlayerController pc; | ||
public bool canSpawn; //At the moment, this isn't necessary | ||
|
||
|
||
// Use this for initialization | ||
void Start () { | ||
Instantiate(player, new Vector3(0f, -4.259603f, 0f), Quaternion.identity); | ||
playerObject = GameObject.FindGameObjectsWithTag("Player")[0]; | ||
pc = playerObject.GetComponent<PlayerController>(); | ||
} | ||
|
||
// Update is called once per frame | ||
void Update () { | ||
//as long as the player isn't swimming, let user determine x position | ||
if (pc.Swimming == false && Application.loadedLevelName.Equals("Level01")) { | ||
Vector3 mPos = Input.mousePosition; | ||
mPos = Camera.main.ScreenToWorldPoint(mPos); | ||
playerObject.transform.position = new Vector3(mPos.x, playerObject.transform.position.y, 0f); | ||
|
||
//the player hits the left mouse button to select the X position | ||
if (Input.GetButtonDown("Fire1")){ | ||
pc.Swimming = true; | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like some of the old code got mixed up with some of the new stuff. I'll do some surgery.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that was always there. It resolved the issue of a shitload of players
spawning when level02 loaded. I admit i don't know why it helped, or if
it's still necessary though... Like I said, sometimes i just fix shit
without regard for best practice
On Fri, Aug 15, 2014 at 5:09 PM, zerosalife [email protected]
wrote: