示例#1
0
    public void SpawnProjectile()
    {
        if (currProjectile != null)
        {
            return;
        }
        TargetProjectile meteor = Instantiate(TrackingMeteorPrefab,
                                              ProjectileSpawnpoint.position, ProjectileSpawnpoint.rotation, this.transform);

        Vector3 dir = Vector3.up;

        dir *= ProjectileImpulse;

        meteor.OnHit  += HitTarget;
        meteor.OnMiss += MissTarget;
        currProjectile = meteor;

        ReceiveCount = 3 - Shields.Count;

        switch (Shields.Count)
        {
        case 3:
            meteor.SpeedOverTime = .1f;
            break;

        case 2:
            meteor.SpeedOverTime = .05f;
            break;

        case 1:
            meteor.SpeedOverTime = .03f;
            break;

        default:
            meteor.SpeedOverTime = .2f;
            break;
        }

        meteor.Fire(this.gameObject, Player.Instance.camera.gameObject, dir);
    }