//On start up void Awake() { animator = transform.Find("Sprite").GetComponent <Animator> (); rb2d = GetComponent <Rigidbody2D> (); shotSpawn = GetComponentInChildren <ShotSpawn> (); shotSpawn.player = gameObject; isoSorting = transform.Find("Sprite").GetComponent <IsoDynamicObject> (); sprite = transform.Find("Sprite").GetComponent <SpriteRenderer> (); playerName = SessionInfo.GetInstance().GetSessionOwner(); attackTrigger.enabled = false; }
void Start() { //NEW CODE HERE GameObject shieldControllerObject = GameObject.FindWithTag("ShieldController"); GameObject playerHealthObject = GameObject.FindWithTag("Health"); GameObject gameControllerObject = GameObject.FindWithTag("GameController"); GameObject shotSpawnObject = GameObject.FindWithTag("ShotSpawn"); GameObject camShakeControllerObject = GameObject.FindWithTag("MainCamera"); if (gameControllerObject != null) { gameController = gameControllerObject.GetComponent <GameController>(); camShake = camShakeControllerObject.GetComponent <cameraShake>(); } if (playerHealthObject != null) { playerHealth = playerHealthObject.GetComponent <PlayerHealth>(); } if (shieldControllerObject != null) { shieldController = shieldControllerObject.GetComponent <ShieldController>(); } if (shotSpawnObject != null) { shotSpawnController = shotSpawnObject.GetComponent <ShotSpawn>(); } fileName = "shoot"; file = new FileInfo(Application.persistentDataPath + "\\" + fileName + ".txt"); //LoadShot(); if (PlayerPrefs.HasKey("Shot")) { loadedFireType = PlayerPrefs.GetInt("Shot"); } else { loadedFireType = 1; } fireType = loadedFireType; rigidBody = gameObject.GetComponent <Rigidbody2D>(); }
void Start() { //NEW CODE HERE GameObject shieldControllerObject = GameObject.FindWithTag("ShieldController"); GameObject playerHealthObject = GameObject.FindWithTag("Health"); GameObject gameControllerObject = GameObject.FindWithTag("GameController"); GameObject shotSpawnObject = GameObject.FindWithTag("ShotSpawn"); GameObject camShakeControllerObject = GameObject.FindWithTag("MainCamera"); if (gameControllerObject != null) { gameController = gameControllerObject.GetComponent<GameController>(); camShake = camShakeControllerObject.GetComponent<cameraShake>(); } if (playerHealthObject!=null) { playerHealth = playerHealthObject.GetComponent<PlayerHealth>(); } if (shieldControllerObject != null) { shieldController = shieldControllerObject.GetComponent<ShieldController>(); } if (shotSpawnObject != null) { shotSpawnController = shotSpawnObject.GetComponent<ShotSpawn>(); } fileName = "shoot"; file = new FileInfo(Application.persistentDataPath + "\\" + fileName + ".txt"); //LoadShot(); if (PlayerPrefs.HasKey("Shot")) { loadedFireType = PlayerPrefs.GetInt("Shot"); } else { loadedFireType = 1; } fireType = loadedFireType; rigidBody = gameObject.GetComponent<Rigidbody2D>(); }