Exemple #1
0
    void SpawnMissile(Vector3 target, string thingType)
    {
        MultigenObject mobj = wad.multigen.objects[thingType];

        LevelEntity thing = SpawnEntity(
            transform.position + Vector3.up * 0.75f * height,
            0f,
            mobj,
            wad
            );

        if (thing.seeSound != null)
        {
            thing.PlaySound(thing.seeSound, false);
        }

        thing.target = this;
        float direction = Mathf.Atan2(target.z - transform.position.z, target.x - transform.position.x) * Mathf.Rad2Deg;

        // TODO: fuzzy player angle variant

        thing.direction = direction;
        thing.move      = (target - thing.transform.position).normalized;
    }