Exemplo n.º 1
0
    public override bool GameUpdate()
    {
        Vector3 d = launchVelocity;

        d.y -= 9.81f * age;
        transform.localRotation = Quaternion.LookRotation(d);

        age += Time.deltaTime;
        Vector3 p = launchPoint + launchVelocity * age;

        p.y -= 0.5f * 9.81f * age * age;

        if (p.y <= 0f)
        {
            TargetPoint.FillBuffer(targetPoint, blastRadius);
            for (int i = 0; i < TargetPoint.BufferedCount; i++)
            {
                TargetPoint.GetBuffered(i).Enemy.ApplyDamage(damage);
            }

            Game.SpawnExplosion().Initialize(targetPoint, blastRadius, damage);

            OriginFactory.Reclaim(this);
            return(false);
        }

        Game.SpawnExplosion().Initialize(p, 0.1f);

        transform.localPosition = p;
        return(true);
    }
Exemplo n.º 2
0
 public void Initialize(Vector3 position, float blastRadius, int damage)
 {
     TargetPoint.FillBuffer(position, blastRadius);
     for (int i = 0; i < TargetPoint.BufferedCount; i++)
     {
         TargetPoint.GetBuffered(i).Enemy.ApplyDamage(damage);
     }
     transform.localPosition = position;
     scale = blastRadius * 0.5f;
 }
Exemplo n.º 3
0
    public override void OnAreaDamage(Vector3 centerPosition)
    {
        base.OnAreaDamage(centerPosition);

        // here implement aoe damage
        TargetPoint.FillBuffer(centerPosition, explodeRadius);
        for (int i = 0; i < TargetPoint.BufferedCount; i++)
        {
            TargetPoint.GetBuffered(i).Enemy.TakeDamage(Damage);
        }
    }
Exemplo n.º 4
0
 public void Modify(Tower tower, float damage)
 {
     TargetPoint.FillBuffer(tower.transform.localPosition, 3.5f, Game.enemyLayerMask);
     for (int i = 0; i < TargetPoint.BufferedCount; i++)
     {
         TargetPoint localTarget = TargetPoint.GetBuffered(i);
         localTarget.Enemy.ApplyDamage(40f, false);
         Explosion explosion = Game.SpawnExplosion(true);
         explosion.Initialize(localTarget, this.GetType().Name + level);
         // localTarget.Enemy.Effects.Add(explosion);
     }
 }
Exemplo n.º 5
0
 public void Initialize(Vector3 position, float blastRange, float demage = 0f)
 {
     if (demage > 0f)
     {
         TargetPoint.FillBuffer(position, blastRange);
         for (int i = 0; i < TargetPoint.BufferedCount; i++)
         {
             TargetPoint.GetBuffered(i).Enemy.ApplyDemage(demage);
         }
     }
     transform.localPosition = position;
     scale = 2f * blastRange;
 }
Exemplo n.º 6
0
 public void Initialize(Vector3 position, float blastRadius, float damage = 0f)
 {
     if (damage > 0f)
     {
         TargetPoint.FillBuffer(position, blastRadius);
         for (int i = 0; i < TargetPoint.BufferedCount; i++)
         {
             TargetPoint.GetBuffered(i).Enemy.ApplyDamage(damage);
         }
     }
     transform.localPosition = position;
     // transform.localScale = Vector3.one * (2f * blastRadius);
     scale = 2f * blastRadius;
 }
Exemplo n.º 7
0
 public override void Modify(TargetPoint enemy, float damage)
 {
     TargetPoint.FillBuffer(enemy.Position, 3.5f, Game.enemyLayerMask);
     for (int i = 0; i < TargetPoint.BufferedCount; i++)
     {
         TargetPoint localTarget = TargetPoint.GetBuffered(i);
         if (localTarget != enemy)
         {
             localTarget.Enemy.ApplyDamage(damage / 2f, false);
             Explosion explosion = Game.SpawnExplosion(false);
             explosion.Initialize(localTarget, this.GetType().Name + level);
             localTarget.Enemy.Effects.Add(explosion);
         }
     }
 }
Exemplo n.º 8
0
 public void Modify(Tower tower)
 {
     buff.level = level;
     buff.name1 = buff.GetType().Name + level;
     TargetPoint.FillBuffer(tower.transform.localPosition, 3.5f, Game.towerLayerMask);
     Debug.Log(TargetPoint.BufferedCount);
     for (int i = 0; i < TargetPoint.BufferedCount; i++)
     {
         TargetPoint localTarget = TargetPoint.GetBuffered(i);
         Debug.Log("LT: " + localTarget);
         Debug.Log("Tower: " + localTarget.Tower);
         if (localTarget != null && !localTarget.Tower.StatusEffects.Any(effect => effect.name1 == buff.name1))
         {
             localTarget.Tower.StatusEffects.Add(buff);
         }
     }
 }
Exemplo n.º 9
0
    private TargetPoint GetTarget()
    {
        if (!TargetPoint.FillBuffer(Position, range))
        {
            target = null;
            return(target);
        }

        if (target && target.isActiveAndEnabled && !target.Enemy.IsDead)
        {
            float colliderRadius = target.ColliderRadius * target.LocalScaleX;
            if (Vector3.Distance(transform.localPosition, target.Position) > range + colliderRadius)
            {
                target = null;
            }
        }
        else
        {
            target = TargetPoint.GetBuffered(0);
        }

        return(target);
    }