示例#1
0
    public void SpitAttack()
    {
        ParabolicProjectile projectile = Instantiate(spitBullet, spitPoint.position, Quaternion.identity)
                                         .GetComponent <ParabolicProjectile>();

        projectile.throwObject = true;
        projectile.SetTarget(spitterAttack.Target.transform.position);
    }
示例#2
0
    public override void OnRelease(Vector2 aim)
    {
        aiming = false;
        GameObject bulletGo = Instantiate(bullet, transform.position, Quaternion.identity);

        parabolicProjectile = bulletGo.GetComponent <ParabolicProjectile>();
        endPosition         = new Vector3(currentAim.x * range, bullet.transform.position.y, currentAim.y * range) + player.position;
        parabolicProjectile.SetTarget(endPosition);
        parabolicProjectile.throwObject = true;
    }
示例#3
0
    private void ShowParabole(Vector3 aim)
    {
        parabolicProjectile = bullet.GetComponent <ParabolicProjectile>();
        endPosition         = new Vector3(aim.x * range, bullet.transform.position.y, aim.y * range) + player.position;
        parabolicProjectile.SetTarget(endPosition);
        int count = 20;

        Vector3[] arcArray = new Vector3[count + 1];
        for (int i = 0; i <= count; i++)
        {
            arcArray[i] = ParabolaEquation.Parabole(player.position, endPosition, parabolicProjectile.height, i / (float)count);
        }
        lr.positionCount = count + 1;
        lr.SetPositions(arcArray);
    }