Beispiel #1
0
 public void SetupProjectile()
 {
     proj = projPool.RequestProjectile();
     proj.LaunchProjectile(projSO, bowDirToTarget, arrowGameObject.transform.position);
     // Activate the trail particle system.
     // trailPartSys.gameObject.SetActive(true);
     // trailPartSys.transform.parent = proj.transform;
     // trailPartSys.transform.position = proj.transform.position;
     // trailPartSys.Play();
 }
Beispiel #2
0
    IEnumerator SpawnGroundSpikes()
    {
        // Decide on first spike's spawn position, for now in direction of player, at a certain distance from self.
        float timer    = 0f;
        int   curSpike = 1;

        normDirToPlayer = (eRefs.playerShadow.position - groundAttackOrigin.position).normalized;
        float firstSpikeDist = ((Vector2)groundAttackOrigin.position - (Vector2)eRefs.PlayerShadowPos).magnitude;

        if (firstSpikeDist > firstSpikeMaxDist)
        {
            firstSpikeDist = firstSpikeMaxDist;
        }
        Vector2 spikePos = (Vector2)groundAttackOrigin.position + (normDirToPlayer * (firstSpikeDist));

        //
        projPool.RequestProjectile().LaunchProjectile(projValues, Vector2.up, spikePos, normDirToPlayer.x);
        while (curSpike < spikeAmount)
        {
            timer += Time.deltaTime;
            if (timer >= delayBetweenSpikes)
            {
                curSpike++;
                timer    = 0f;
                spikePos = (Vector2)groundAttackOrigin.position + (normDirToPlayer * (firstSpikeDist + (spikeSpawnDist * (curSpike - 1))));
                if (curSpike == spikeAmount)   // Spawn the last spike (different one).
                {
                    projPool.RequestProjectile().LaunchProjectile(lastProjValues, Vector2.up, spikePos, normDirToPlayer.x);
                }
                else
                {
                    projPool.RequestProjectile().LaunchProjectile(projValues, Vector2.up, spikePos, normDirToPlayer.x);
                }
            }
            yield return(null);
        }
    }
 public void AnimLaunchSlashProjectile()
 {
     projPool.RequestProjectile().LaunchProjectile(pV, slashProjDirection, attackDirPoint.position);
 }