// Update is called once per frame void Update() { //health counter if (currentHealth <= 0) { Death(); } //recieves signal from the boss seekingPlayer = mainBoss.GetComponent <BossMain>().sendToPlayer; if (seekingPlayer) { OrbitalStatus = StateOfOrb.Seeking; } if (OrbitalStatus == StateOfOrb.Spawnning) { StartingOrbit(); } if (OrbitalStatus == StateOfOrb.Orbiting) { OrbitingStuff(); } if (OrbitalStatus == StateOfOrb.Seeking) { SeekingPlayer(); } }
// Use this for initialization void Start() { currentHealth = maxHealth; //the main object these things orbit mainBoss = GameObject.FindGameObjectWithTag("PoisonIvyMain"); player = GameObject.FindGameObjectWithTag("Player"); //the speed it spawns from the boss ejectSpeed = Random.Range(ejectSpeedMin, ejectSpeedMax); OrbitalStatus = StateOfOrb.Spawnning; center = mainBoss.transform; }
//it gets spawned and locates the boss before spawning void StartingOrbit() { this.transform.Translate(Vector3.forward * ejectSpeed * Time.deltaTime); ejectSpeed -= 2.5f * Time.deltaTime; if (ejectSpeed <= 0) { RaycastHit hit; Ray ray = new Ray(this.transform.position, Vector3.back); if (Physics.Raycast(ray, out hit)) { radius = hit.distance; } OrbitalStatus = StateOfOrb.Orbiting; } }