void Start() { playerManager = GameObject.Find(ScriptNames.PlayerManager.GetString()).GetComponent <PlayerManager>(); // Health coolDownTimer = 0; healthBarPos = new Vector3(0, 0, 0); healthBar = Instantiate(serialBar, healthBarPos, transform.localRotation).GetComponent <HealthBar>(); health = totalHealth; healthBar.setSize(health); healthBar.setColor(Color.green); // Initialize variables gunAngle = 0F; astroAngle = 0F; xVel = 0F; yVel = 0F; // Screen size (top, right, bottom, left) = Game.getBounds(); // Bullet shotTimer = 0; shotLimit = 0.25F; isShotgun = false; isLaser = false; isBounce = false; }
void Start() { playerManager = GameObject.Find(ScriptNames.PlayerManager.GetString()).GetComponent <PlayerManager>(); (float xAstroVel, float yAstroVel) = playerManager.getVelocities(); (top, right, bottom, left) = Game.getBounds(); float dev = Random.Range(-1f, 1f); speed = speedAvg + speedDev * dev; rotSpeed = rotAvg - rotDev * dev; angle = Random.Range(0f, 360f); xVel = velReduce * xAstroVel + speed * Mathf.Cos(angle * Mathf.Deg2Rad); yVel = velReduce * yAstroVel + speed * Mathf.Sin(angle * Mathf.Deg2Rad); }