public override void shoot(GameObject beam, RageHandler rageHandler, Vector3 moveDirection, bool raging) { if (!audio.isPlaying) { audio.Play(); } Vector3 difference = Vector3.right * Random.Range(0f, 0.15f) + Vector3.up * Random.Range(-0.5f, 0.5f); float bulletSizeMax = 5.0f; Bullet b = (Instantiate(beam, gameObject.GetComponent <CuttlefishMovement>().beamPosition.transform.position + difference, transform.rotation) as GameObject).GetComponent <Bullet>(); if (raging) { b.transform.localScale *= (10f); b.particleSystem.startSize *= (3f); } else { b.transform.localScale *= (1 + rageHandler.getRatio() * bulletSizeMax); b.transform.parent = transform.parent; b.particleSystem.startSize *= (1 + rageHandler.getRatio()); } b.origPosition = gameObject.GetComponent <CuttlefishMovement>().beamPosition.transform.position; float xVal = Random.Range(0f, 1f); float yVal = Random.Range(-0.5f, 4f); b.mvmntVector = new Vector3(xVal, yVal, 0); }
// Use this for initialization void Start() { playerPieces = GetComponentsInChildren <Renderer>(); goalRotation = Quaternion.Euler(new Vector3(0, 180, 0)); facingRight = true; origSpeedVal = speed; shootPeriod += rageHandler.getRatio(); angerBarHeight = Screen.height / rageHandler.divisorForRageMeter; }
// Update is called once per frame void Update() { //Debug.Log("Rage Ratio: "+rageHandler.getRatio()); scrollSpeed = origSpeed + maxExtraSpeed * rageHandler.getRatio(); //Debug.Log("Scroll Speed: "+scrollSpeed); //Change not to add on and to just eaual ratio for acceleration offset += scrollSpeed * Time.deltaTime; //((scrollSpeed)); renderer.material.SetTextureOffset("_MainTex", new Vector2(offset, 0)); }
void Start() { origColor = renderer.material.color; //Cheat for now to link damage and size/rage //damage = transform.localScale.x; if (rageHandler != null) { damage = 1 + rageHandler.getRatio() * transform.localScale.x; } }
void Update() { if (timer < staticGeneration && test < 6) { timer += Time.deltaTime * Random.Range(0.7f, 0.9f); Vector3 difference = bottom.position - top.position; if (timer > 1.5 && timer < 2.0f && test < 1) { for (int i = 0; i < 3; i++) { float amnt = ((float)i / (float)3) + Random.Range(0, 0.5f); Vector3 pos = top.position + difference * amnt; Instantiate(enemyPrefabs[0], pos, transform.rotation); } test = 1; } else if (timer > 4.5f && timer < 5.0f && test < 2) { for (int i = 0; i < 1; i++) { float amnt = ((float)i / (float)1) + Random.Range(0, 0.5f); Vector3 pos = top.position + difference * amnt; Instantiate(enemyPrefabs[0], pos, transform.rotation); } test = 2; } else if (timer > 8.5f && timer < 9.0f && test < 3) { for (int i = 0; i < 2; i++) { float amnt = ((float)i / (float)2) + Random.Range(0, 0.5f); Vector3 pos = top.position + difference * amnt; Instantiate(enemyPrefabs[2], pos, transform.rotation); } test = 3; } else if (timer > 13.5f && timer < 14.0f && test < 4) { for (int i = 0; i < 1; i++) { float amnt = ((float)i / (float)3) + Random.Range(0, 0.5f); Vector3 pos = top.position + difference * amnt; Instantiate(enemyPrefabs[1], pos, transform.rotation); } test = 4; } else if (timer > 18.5f && timer < 19.0f && test < 5) { for (int i = 0; i < 3; i++) { float amnt = ((float)i / (float)1) + Random.Range(0, 0.5f); Vector3 pos = top.position + difference * amnt; Instantiate(enemyPrefabs[1], pos, transform.rotation); } test = 5; } else if (timer > 24.5f && timer < 25.0f && test < 6) { for (int i = 0; i < 2; i++) { float amnt = ((float)i / (float)2) + Random.Range(0, 0.5f); Vector3 pos = top.position + difference * amnt; Instantiate(enemyPrefabs[3], pos, transform.rotation); } test = 6; } } else { if (timer < timerMax) { timer += Time.deltaTime * Random.Range(0.7f, 0.9f); } else { timer = 0; //Instantiate int enemyWaveType = Random.Range(0, enemyPrefabs.Length); int numEnemies = Random.Range(1, maxNumEnemies + 1); Vector3 difference = bottom.position - top.position; //Normal enemy if (enemyWaveType == 0) { } else if (enemyWaveType == 1) //Police Enemy { if (rageHandler.getRatio() < 0.2f) { numEnemies = 1; } else if (rageHandler.getRatio() > 0.9f) { numEnemies = maxNumEnemies + 2; //changed from maxNumEnemies+2 } } else if (enemyWaveType == 2) //Powerup Enemy { numEnemies = 1; } else if (enemyWaveType == 3) //Speed Enemy { if (rageHandler.getRatio() < 0.7f) { numEnemies = 1; } else { if (numEnemies > 2) { numEnemies = 2; } } /** * else if(rageHandler.getRatio()>0.9f) * { * numEnemies=maxNumEnemies+2; //maxNumEnemies+2 * } */ } else if (enemyWaveType == 4) //Tough Enemy { if (rageHandler.getRatio() < 0.2f) { enemyWaveType = 0; } else if (rageHandler.getRatio() < 0.9f) { numEnemies = Random.Range(1, 3); } } for (int i = 0; i < numEnemies; i++) { float amnt = ((float)i / (float)numEnemies) + Random.Range(0, 0.5f); Vector3 pos = top.position + difference * amnt; Instantiate(enemyPrefabs[enemyWaveType], pos, transform.rotation); } } } }
//shoots a single radial burst of bullets public override void shoot(GameObject beam, RageHandler rageHandler, Vector3 moveDirection, bool raging) { if (!audio.isPlaying) { audio.Play(); } maxAmtBullets = (5) + (int)(5 * (rageHandler.getRatio())); numOfBulletsInCircle = Random.Range(minAmtBullets, (int)(maxAmtBullets)); Vector3 difference = Vector3.right * Random.Range(-0.15f, 0.15f) + Vector3.up * Random.Range(-0.15f, 0.15f); float bulletSizeMax = 5.0f; //CalculateMovementVector(); divisibleBullets = numOfBulletsInCircle; while (divisibleBullets % 4 != 0) { divisibleBullets++; } int quad1 = divisibleBullets / 4; int quad2 = quad1 * 2; int quad3 = quad1 * 3; int quad4 = quad1 * 4; for (int x = 0; x < numOfBulletsInCircle; x++) { Bullet b = (Instantiate(beam, gameObject.GetComponent <CuttlefishMovement>().beamPosition.transform.position + difference, transform.rotation) as GameObject).GetComponent <Bullet>(); //b.transform.localScale*=(1+rageHandler.getRatio()*bulletSizeMax); //if(rageHandler.getRatio()==1) //{ // b.transform.localScale*= bulletSizeMax; //} b.transform.parent = transform.parent; b.origPosition = gameObject.GetComponent <CuttlefishMovement>().beamPosition.transform.position; float xVal; float yVal; if (x < quad1 || x == quad1) { xVal = (float)(quad1 - x) / quad1; yVal = (float)x / quad1; } else if (x < quad2 || x == quad2) { xVal = (float)(quad1 - x) / quad1; yVal = (float)(quad2 - x) / quad1; } else if (x < quad3 || x == quad3) { xVal = (float)(x - quad3) / quad1; yVal = (float)(quad2 - x) / quad1; } else { xVal = (float)(x - quad3) / quad1; yVal = (float)(x - quad4) / quad1; } xVal *= Random.Range(-4f, 4f); yVal *= Random.Range(-4f, 4f); if (raging) { b.transform.localScale *= (10f); b.particleSystem.startSize *= (3f); } b.mvmntVector = new Vector3(xVal, yVal, 0); b.mvmntVector.Normalize(); } }