private void AbsorbAtk() { _rotationAngle += 1 * _rotateSpeed * Time.deltaTime; transform.eulerAngles = new Vector3(0, transform.eulerAngles.y + _rotationAngle, 0); if (_invinciblesAddad == false) { for (int index = 0; index < _attachedShooter.GetGhlostsInScene.Count; index++) { if (_attachedShooter.GetGhlostsInScene[index].GetComponent <DumbBossGlhost>().GetMyMechanic == Mechanic.CHASE) { DumbBossGlhost ghlostRef = _attachedShooter.GetGhlostsInScene[index].GetComponent <DumbBossGlhost>(); ghlostRef.GetSpeed = _absorbSpeed; ghlostRef.setMove(transform.eulerAngles); _absorbingGhlosts.Add(_attachedShooter.GetGhlostsInScene[index]); } } /* * Debug.DrawRay(transform.position + (Vector3.up * 1f), (transform.forward * 100f), Color.green); * if (Physics.Raycast(transform.position + (Vector3.up * 1f), transform.forward, out hit, 100f)) * { * * //transform.eulerAngles += new Vector3(0, angle, 0); * if (hit.collider.GetComponent<DumbBossGlhost>()) * { * if (hit.collider.GetComponent<DumbBossGlhost>().GetMyMechanic == Mechanic.CHASE) * { * for (int i = 0; i < _absorbingGhlo`sts.Count; i++) * { * if (hit.collider.gameObject == _absorbingGhlosts[i]) * { * return; * } * } * DumbBossGlhost ghlostRef = hit.collider.GetComponent<DumbBossGlhost>(); * ghlostRef.GetSpeed = _absorbSpeed; * ghlostRef.setMove(transform.eulerAngles); * _absorbingGhlosts.Add(ghlostRef.gameObject); * } * } * * } */ _invinciblesAddad = true; } else if (_absorbingGhlosts.Count != _absorbedGhlosts.Count) { _rotationAngle += 1 + _rotateSpeed * Time.deltaTime; transform.eulerAngles = new Vector3(0, _rotationAngle, 0); } else if (_absorbingGhlosts.Count == _absorbedGhlosts.Count) { _ghlostsShot = 0; _MyState = SHOOTERSTATES.SHOOT; _startTimer = Time.time; } }
private void ShootAtPlayer() { if (_ghlostsShot < _absorbedGhlosts.Count) { float timeTaken = Time.time - _startTimer; gameObject.transform.LookAt(_playerRef.transform); //Spawns a new glhost based on the spawnrate if (timeTaken >= _shootRate * _ghlostsShot) { DumbBossGlhost ghlostRef = _absorbedGhlosts[_ghlostsShot].GetComponent <DumbBossGlhost>(); ghlostRef.gameObject.SetActive(true); ghlostRef.setMove(_playerRef.transform.position); _ghlostsShot++; } Debug.Log("Shooting Ghlosts"); } else { _MyState = SHOOTERSTATES.STUNNED; } }