Beispiel #1
0
    void DarkSphereLaunch()
    {
        FindDirection();
        Debug.DrawLine(To, From, Color.red);
        float        _angle           = Mathf.Atan2(DirFromTo.y, DirFromTo.x) * Mathf.Rad2Deg;
        GameObject   projectileObject = Instantiate(PrefabBall, To, Quaternion.Euler(0, 0, _angle));
        BossFireBall projectile       = projectileObject.GetComponent <BossFireBall>();

        projectile.Launch(DirFromTo, 600);
    }
Beispiel #2
0
    void Launch()
    {
        _sphere[_currentSphere].SetActive(false);
        From      = PointFrom.position;
        To        = PointTo.position;
        DirFromTo = From - curPos;
        DirFromTo.Normalize();
        Debug.DrawLine(curPos, From, Color.red);
        _angle = Mathf.Atan2(DirFromTo.y, DirFromTo.x) * Mathf.Rad2Deg;
        GameObject   projectileObject = Instantiate(SpearPrefab, curPos, Quaternion.Euler(0, 0, _angle));
        BossFireBall projectile       = projectileObject.GetComponent <BossFireBall>();

        projectile.Launch(DirFromTo, 500);
    }
Beispiel #3
0
    private void Update()
    {
        HealthBar.value = CurrentHealth;


        //ChangeMoovingDirection();
        GroundDetection();
        Attacked();
        CheckHpForShield();
        Die();

        if (_casting)
        {
            _castTimer -= Time.deltaTime;
        }

        if (_walkTimer >= 0)
        {
            _walkTimer -= Time.deltaTime;
        }
        if (_walkTimer <= 0)
        {
            _casting = true;
            Speed    = 0;

            if (!_sphereOn)
            {
                ParticleSystem _sphere = Instantiate(PrefabSphere, (Vector2)transform.position + Vector2.up * 1.7f, Quaternion.identity);
                _sphereOn = true;
            }
        }
        if (_castTimer <= 0)
        {
            if (CurrentHealth <= 500 && _stormOn && !_stormOn2)
            {
                for (int i = 0; i < StormPos.Length; i++)
                {
                    GameObject   projectileObject = Instantiate(PrefabBall, StormPos[i].transform.position, Quaternion.Euler(0, 0, -90));
                    BossFireBall projectile       = projectileObject.GetComponent <BossFireBall>();
                    projectile.Launch(Vector3.down, 100);
                }
                _stormOn2 = true;
            }

            DarkSphereLaunch();
            _sphereOn  = false;
            _casting   = false;
            _walkTimer = WalkTimer;
            _castTimer = CastTimer;
            Speed      = NormalSpeed;
        }
        if (CurrentHealth <= 500)
        {
            if (!_stormOn)
            {
                _castTimer = CastTimer;
                _casting   = true;
                Speed      = 0;
                WalkTimer  = 1;
                for (int i = 0; i < StormPos.Length; i++)
                {
                    Instantiate(PrefabSphere, StormPos[i].transform.position, Quaternion.identity);
                }
            }
            _stormOn = true;
        }
    }