private void Start() { camTransform = transform; //cam = Camera.main; currentX = editCameraRotation; //referencing the player manager GameObject manager = GameObject.Find("playerManager"); playerSpawner playerSpawn = manager.GetComponent <playerSpawner> (); camNumb = playerSpawn.setCamNumber(); }
protected virtual void Awake() { // this might throw things for a loop if its start instead of Awake. keep an eye out to see if stuff happens instance = this; numOfPlayers = GameManager.instance.numOfPlayers; int[] randomPosition = new int[(int)numOfPlayers]; randomizePlayerOrder(randomPosition); Vector3[] pos = new Vector3[(int)numOfPlayers]; for (int i = 0; i < numOfPlayers; i++) { pos[i] = transform.position - Vector3.right * (width / 2 - width / (numOfPlayers - 1) * randomPosition[i]); } spawnPlayers(pos); }
void Start() { //referencing the player manager GameObject manager = GameObject.Find("playerManager"); playerSpawner playerSpawn = manager.GetComponent <playerSpawner> (); playNumb = playerSpawn.setPlayerNumber(); // this.gameObject.transform.rotation = Quaternion.Euler((new Vector3(0,startRotation,0))); //get componets rb = GetComponent <Rigidbody>(); ren = GetComponent <Renderer> (); audioSource.clip = audioBreakClip; }
public int augmentHookshotIdentifier; // hookshot void Awake() { /// SINGLETON //================================================================ if (GameManager == null) { GameManager = this; } else if (GameManager != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); /// GET PLAYER SPAWNER //======================================================= if (GameObject.Find("PlayerSpawner") != null) { playerSpawner = GameObject.Find("PlayerSpawner").gameObject; playerSpawnerScript = playerSpawner.GetComponent <playerSpawner>(); } }
public void Initialise() { if (GameObject.Find("PlayerSpawner").gameObject != null) /// CULL PARTS AND AUGMENTS ON THE MAP THAT THE PLAYER CURRENTLY HAS EQUIPPED // { if (currentLevel == SceneManager.GetActiveScene().buildIndex) { if (partConfiguration != 1 & partConfiguration != 3) { GameObject[] arms = GameObject.FindGameObjectsWithTag("Arms"); if (arms.Length != 0) { for (int i = 0; i < arms.Length; i++) { if (arms[i].name != "playerCollider" && arms[i].GetComponent <Arms>().instance == armIdentifier) { Destroy(arms[i]); break; } } } } if (partConfiguration >= 3) { GameObject[] legs = GameObject.FindGameObjectsWithTag("Legs"); if (legs.Length != 0) { for (int i = 0; i < legs.Length; i++) { if (legs[i].name != "playerCollider" && legs[i].GetComponent <Legs>().instance == legIdentifier) { Destroy(legs[i]); break; } } } } GameObject[] augments = GameObject.FindGameObjectsWithTag("HeadAugment"); if (augments.Length != 0) { for (int i = 0; i < augments.Length; i++) { int foundIdentifier = augments[i].GetComponent <augmentPickup>().instance; if ((foundIdentifier == augmentScalerIdentifier || foundIdentifier == augmentHookshotIdentifier)) { Destroy(augments[i]); } } } } if (currentLevel != SceneManager.GetActiveScene().buildIndex) { playerSpawner = GameObject.Find("PlayerSpawner").gameObject; playerSpawnerScript = playerSpawner.GetComponent <playerSpawner>(); playerSpawnerScript.preview = true; playerSpawnerScript.Preview(); xPosition = playerSpawnerScript.editorSpawnPos.x; yPosition = playerSpawnerScript.editorSpawnPos.y; partConfiguration = playerSpawnerScript.partConfiguration; headConfiguration = playerSpawnerScript.headConfiguration; armConfiguration = playerSpawnerScript.armConfiguration; legConfiguration = playerSpawnerScript.legConfiguration; scoutEnabled = playerSpawnerScript.scoutEnabled; armIdentifier = 0; legIdentifier = 0; augmentScalerIdentifier = 0; augmentHookshotIdentifier = 0; currentLevel = SceneManager.GetActiveScene().buildIndex; } Vector2 spawnPos = new Vector2(xPosition, yPosition); playerSpawner = GameObject.Find("PlayerSpawner").gameObject; playerSpawnerScript = playerSpawner.GetComponent <playerSpawner>(); playerSpawnerScript.OverrideSpawn(spawnPos, partConfiguration, headConfiguration, armConfiguration, legConfiguration, armIdentifier, legIdentifier, augmentScalerIdentifier, augmentHookshotIdentifier, scoutEnabled); } }
void Awake() { CPlist = GameObject.FindGameObjectsWithTag("Checkpoint"); PS = GameObject.Find("playerManager").GetComponent <playerSpawner>(); }