private void Attack()
 {
     if (currentAbility == ELensType.None)
     {
         AttackBasic attack = Instantiate(attacks[(int)currentAbility].prefabToSpawn).GetComponent <AttackBasic>();
         attack.transform.position = firingPoint.position;
         attack.SetUpLine(firingPoint, aimRaycaster.currentLookPosition);
         if (aimRaycaster.currentTargetable != null)
         {
             aimRaycaster.currentTargetable.DealDamage(attack.damage);
         }
     }
     else if (currentAbility == ELensType.Flame)
     {
         GameObject fireball = fireballPooler.RequestDequeue();
         fireball.transform.position = firingPoint.position;
         fireball.SetActive(true);
         fireball.GetComponent <AttackFireball>().owner = this.gameObject;
         fireball.GetComponent <Rigidbody>().velocity   =
             (aimRaycaster.currentLookPosition - firingPoint.position).normalized * attacks[(int)currentAbility].projectileSpeed;
         PersistantPlayer.StaticInstance.playerRB.AddForce((transform.position - aimRaycaster.currentLookPosition).normalized * 300f);
         PersistantPlayer.StaticInstance.source.GenerateImpulse(.3f);
     }
     else if (currentAbility == ELensType.Frost)
     {
         Instantiate(attacks[(int)currentAbility].prefabToSpawn, aimRaycaster.currentLookPosition, Quaternion.identity);
     }
     else if (currentAbility == ELensType.Lightning)
     {
         Instantiate(attacks[(int)currentAbility].prefabToSpawn, Vector3.Scale(aimRaycaster.currentLookPosition, new Vector3(1, 0, 1)), Quaternion.identity);
     }
     attacks[(int)currentAbility].currentCooldown = 0;
 }
Beispiel #2
0
    public override void DoFiringBehaviour()
    {
        base.DoFiringBehaviour();
        AttackBasic attack = Instantiate(linePrefab);

        attack.transform.position = transform.position;
        attack.SetUpLine(transform, sampledPoint);
        //AttackLightning lightning = Instantiate(lightningPrefab, Vector3.Scale( sampledPoint, new Vector3(1,0,1)), Quaternion.Euler(Random.insideUnitSphere));
        StartCoroutine(SmallDelay());
    }
Beispiel #3
0
    public override void DoFiringBehaviour()
    {
        base.DoFiringBehaviour();

        AttackBasic attack = Instantiate(linePrefab);

        attack.transform.position = transform.position;
        attack.SetUpLine(transform, sampledPoint);

        StartCoroutine(SmallDelay());
    }