Example #1
0
    private void VoidZoneCasting()
    {
        timerForVoidZoneReloading += Time.deltaTime * main.curSlowerCoeff;
        timerForVoidZoneCasting   += Time.deltaTime * main.curSlowerCoeff;

        if (timerForVoidZoneReloading >= voidZoneReloadingTime)
        {
            VoidZone voidZone = main.voidZonesPool.GetChild(0).GetComponent <VoidZone>();
            voidZone.transform.parent = null;
            //if ((main.player.transform.position - transform.position).magnitude <= shootRange)
            //{
            //    voidZone.transform.position = main.player.transform.position;
            //}
            //else
            //{
            //    GetRandomPoint(transform.position, voidZoneCastRange);
            //    if (path.corners.Length > 1) voidZone.transform.position = path.corners.Last();
            //}
            if (voidZoneCastRange == 0)
            {
                voidZone.transform.position = transform.position;
            }
            else
            {
                GetRandomPoint(transform.position, voidZoneCastRange);
                if (path.corners.Length > 1)
                {
                    voidZone.transform.position = path.corners.Last();
                    ShowVoidZoneTraectory(voidZone.transform.position, 50f);
                }
            }
            voidZone.damage = voidZoneDamage;
            voidZone.radius = voidZoneRadius;
            voidZone.transform.localScale = Vector3.one * voidZoneRadius;
            voidZone.duration             = voidZoneDuration;
            voidZone.isCasting            = true;
            voidZone.Custer = this;
            voidZone.VZShowRadius();

            Transform vzce = main.voidZoneCastEffectsPool.GetChild(0);
            vzce.transform.parent   = null;
            vzce.transform.position = transform.position;
            voidZone.castEffect     = vzce;

            timerForVoidZoneReloading = 0;
            timerForVoidZoneCasting   = 0;
        }
    }
Example #2
0
 protected override void Start()
 {
     base.Start();
     voidZone  = GetComponentInChildren <VoidZone>();
     demonType = DemonType.VoidGuardian;
 }