// Use this for initialization void Start() { speedOffset = Random.Range(5, 30); lG = laser.GetComponent <LaserGun>(); lG.setStats(5f, 8f, 5f, 0.5f); foreach (Transform child in transform) { // do whatever you want with child transform object here if (child.name == "LaserGun") { laser = child; } } lG.fire(); //sF = gameObject.GetComponent<SmoothFollow>(); //sF.enabled = false; isTeleported = false; isVenting = false; hasExploded = false; /* * GameObject.Instantiate(spawnOutline, new Vector3(transform.position.x, * transform.position.y, * transform.position.z), Quaternion.identity); */ }
// Use this for initialization void Start() { isDead = false; hasExploded = false; isRestarting = false; restartMode = false; NextFireAt = Time.time; // restart fire timer dir = Vector3.zero; // no direction // set player stats from the preferences! maxHp = 1 + PlayerPrefs.GetInt("PHealth"); currentHp = 1 + PlayerPrefs.GetInt("PHealth"); maxShield = PlayerPrefs.GetInt("PShield"); currentShield = 0; rotationSpeed = 9.0f + PlayerPrefs.GetInt("PTurnRate") * 2; speed = speed + PlayerPrefs.GetInt("PThrusters") * 2; currentWeapon = PlayerPrefs.GetInt("CurrentWeapon"); fireRateMod = PlayerPrefs.GetInt("W1FireRate") / 10.0f; // firerates and damage // keep track of other stuff screenManager = GameObject.Find("ScreenManager").GetComponent <ScreenManager>(); levelLogic = GameObject.Find("Level").GetComponent <LevelLogic>(); missionControl = GameObject.Find("MissionControl").GetComponent <MissionControl>(); LaserGun lG = laser.GetComponent <LaserGun>(); lG.setStats((float)PlayerPrefs.GetInt("W1Damage") * 3, (float)PlayerPrefs.GetInt("W1Range"), LaserFireRate - fireRateMod, 0.5f); foreach (Transform child in transform) { // do whatever you want with child transform object here if (child.name == "LaserGun") { laser = child; } } //instantiate the health bar for (int z = 0; z < maxHp; z++) { Transform tmpB = hpBar; tmpB.tag = "hp" + z.ToString(); Instantiate(tmpB, new Vector3(-46 + z * 1.25f, 25, 0), Quaternion.identity); //hpBars.Add(hpBar); finalX = -46 + z * 1.25f; } finalX += 1.25f; for (int s = 0; s < currentShield; s++) { Transform tmpB = shieldBar; tmpB.tag = "shield" + s.ToString(); Instantiate(tmpB, new Vector3(finalX + s * 1.25f, 25, 0), Quaternion.identity); //hpBars.Add(hpBar); } Debug.Log("player born!"); }