// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody>(); anim = GetComponent <Animator>(); crosshairAnim = crosshair.gameObject.GetComponent <Animator>(); aud = GetComponent <AudioSource>(); ammoSlider.value = AmmoCount; shoot = GetComponent <shootingScript>(); }
void Start() { nav = GetComponent <NavMeshAgent>(); if (patrolPointList.Length > 0) { nav.SetDestination(patrolPointList[currentPoint].position); } anim = GetComponent <Animator>(); aud = GetComponent <AudioSource>(); rb = GetComponent <Rigidbody>(); shoot = GetComponent <shootingScript>(); playerChar = GameObject.Find("Player").GetComponent <Transform>(); playerLocator = GameObject.Find("PlayerLocationWithLerpSphere").GetComponent <Transform>(); StartCoroutine("keepLookout"); //CHANGE LATER MAYBE?? ONCE I FIGURE OUT WATH TO HE'LL I AM DOING currentTarget = playerChar; }
// Update is called once per frame void Update() { colorState = GameObject.Find("mainBarrel").GetComponent <shootingScript>(); if (colorState.shipCurrent == shootingScript.shipType.Red) { shipCurrent = shipType.Red; } if (colorState.shipCurrent == shootingScript.shipType.Blue) { shipCurrent = shipType.Blue; } if (colorState.shipCurrent == shootingScript.shipType.Green) { shipCurrent = shipType.Green; } // Ship shooting with different colors if (Input.GetKey(KeyCode.UpArrow)) { if (shipCurrent == shipType.Red && Time.time > nextFire) { nextFire = Time.time + fireRate; RedAtk(); } else if (shipCurrent == shipType.Green) { GrenAtk(); } } if (Input.GetKeyDown(KeyCode.UpArrow)) { if (shipCurrent == shipType.Blue) { BluAtk(); } } }
// Use this for initialization void Start() { animStateSetter = GetComponent <Animator>(); stateSender = GetComponent <movement>(); shooting = GetComponent <shootingScript>(); }
void OnTriggerEnter2D(Collider2D hit) { lm = GameObject.Find("Game Manager").GetComponent <LifeManager>(); RedBallrate = GameObject.FindObjectOfType <shootingScript>() as shootingScript; spreadShotScript[] RedBallSpread = GameObject.FindObjectsOfType <spreadShotScript>() as spreadShotScript[]; if (hit.tag == "Red_Projectile" && this.gameObject.tag == "Red") { enemyTailScript[] tailScripts = GameObject.FindObjectsOfType <enemyTailScript>() as enemyTailScript[]; foreach (enemyTailScript t in tailScripts) { if (t.gameObject.name.Equals("Snake Tail " + id)) { Destroy(t.gameObject); lm.EnemyDeaths++; RedBallrate.fireRate -= 0.02f; RedBallSpread[0].fireRate -= 0.02f; RedBallSpread[1].fireRate -= 0.02f; Red_Ball.Speed += 2f; Red_Ball.bulletWidth += 0.004f; } } lm.EnemyDeaths++; RedBallrate.fireRate -= 0.02f; RedBallSpread[0].fireRate -= 0.02f; RedBallSpread[1].fireRate -= 0.02f; Red_Ball.Speed += 2f; Red_Ball.bulletWidth += 0.004f; Destroy(gameObject); //SnakeTail.gameObject.GetComponent<enemyTailScript>().isHeadDead = true; } if (hit.tag == "Blue_Projectile" && this.gameObject.tag == "Blue") { enemyTailScript[] tailScripts = GameObject.FindObjectsOfType <enemyTailScript>() as enemyTailScript[]; foreach (enemyTailScript t in tailScripts) { if (t.gameObject.name.Equals("Snake Tail " + id)) { Blue_Laser.maxLaserScale += 0.02f; Blue_Laser.laserSpeed += 0.02f; Blue_Laser.laserWidth += 0.005f; lm.EnemyDeaths++; Destroy(t.gameObject); } } Blue_Laser.maxLaserScale += 0.02f; Blue_Laser.laserSpeed += 0.02f; Blue_Laser.laserWidth += 0.005f; lm.EnemyDeaths++; Destroy(gameObject); } if (hit.tag == "Green_Projectile" && this.gameObject.tag == "Green") { enemyTailScript[] tailScripts = GameObject.FindObjectsOfType <enemyTailScript>() as enemyTailScript[]; foreach (enemyTailScript t in tailScripts) { if (t.gameObject.name.Equals("Snake Tail " + id)) { Green_Ball.Speed += 0.05f; Green_Ball.explosionSize += 0.02f; Green_Ball.explosionSpeed += 0.04f; lm.EnemyDeaths++; Destroy(t.gameObject); } } Green_Ball.Speed += 0.05f; Green_Ball.explosionSize += 0.02f; Green_Ball.explosionSpeed += 0.04f; lm.EnemyDeaths++; Destroy(gameObject); } }
// Update is called once per frame void Update() { RedBallrate = GameObject.FindObjectOfType <shootingScript>() as shootingScript; spreadShotScript[] RedBallSpread = GameObject.FindObjectsOfType <spreadShotScript>() as spreadShotScript[]; if (Input.GetKeyDown(KeyCode.LeftArrow)) { shipCurrent = shipType.Red; shipModel.gameObject.GetComponent <SpriteRenderer>().color = shipColors[0]; } if (Input.GetKeyDown(KeyCode.DownArrow)) { shipCurrent = shipType.Blue; shipModel.gameObject.GetComponent <SpriteRenderer>().color = shipColors[1]; } if (Input.GetKeyDown(KeyCode.RightArrow)) { shipCurrent = shipType.Green; shipModel.gameObject.GetComponent <SpriteRenderer>().color = shipColors[2]; } // Ship shooting with different colors if (Input.GetKey(KeyCode.UpArrow)) { if (shipCurrent == shipType.Red && Time.time > nextFire) { nextFire = Time.time + fireRate; muzzleTypes[0].enabled = true; RedAtk(); } else if (shipCurrent == shipType.Green) { muzzleTypes[2].enabled = true; GrenAtk(); } } if (Input.GetKeyDown(KeyCode.UpArrow)) { if (shipCurrent == shipType.Blue) { muzzleTypes[1].enabled = true; BluAtk(); } } if (Input.GetKeyUp(KeyCode.UpArrow)) { muzzleTypes[0].enabled = false; muzzleTypes[1].enabled = false; muzzleTypes[2].enabled = false; } //Spread shot debug key if (Input.GetKeyDown(KeyCode.Space)) { Barrels[0].gameObject.GetComponent <spreadShotScript>().enabled = true; Barrels[1].gameObject.GetComponent <spreadShotScript>().enabled = true; } //Weapon Steroids debug //red if (Input.GetKeyDown(KeyCode.Alpha1)) { RedBallrate.fireRate -= 1f; RedBallSpread[0].fireRate -= 1f; RedBallSpread[1].fireRate -= 1f; Red_Ball.Speed += 5f; Red_Ball.bulletWidth += 1f; } //blue if (Input.GetKeyDown(KeyCode.Alpha2)) { Blue_Laser.maxLaserScale += 1f; Blue_Laser.laserSpeed += 1f; Blue_Laser.laserWidth += 1f; } //green if (Input.GetKeyDown(KeyCode.Alpha3)) { Green_Ball.Speed += 1f; Green_Ball.explosionSize += 1f; Green_Ball.explosionSpeed += 1f; } }