Example #1
0
File: Entities.cs Project: N-01/UFO
    public Ufo(FixedPointVector3 _pos, FixedPoint _diameter)
    {
        type = EntityType.Ufo;

        originPosition          = _pos;
        speed                   = Extensions.Range(0.5f, 1f);
        orbitRadius             = scale;
        asteroidDetectionRadius = _diameter * 5;

        health = 20;

        body = new CircleBody(originPosition, _diameter * (FixedPoint)0.5f, this);

        body.SetLayer(type);
        body.SetCollidesWith(EntityType.Asteroid, true);
        body.SetCollidesWith(EntityType.Blast, true);
        body.SetCollidesWith(EntityType.Placeholder, true);
        body.SetCollidesWith(EntityType.Ufo, true);

        //randomize rotations
        if (Random.value > 0.5f)
        {
            orbitSpeedPerSecond = -orbitSpeedPerSecond;
        }

        currentOrbitAngle = Extensions.Range(0, Mathf.PI * 2);

        behavior = new UfoBehavior(this);
    }
Example #2
0
File: Entities.cs Project: N-01/UFO
    public Asteroid(FixedPointVector3 _pos, FixedPoint _scale)
    {
        position = _pos;
        scale    = _scale;
        speed    = Extensions.Range(1, 2);
        health   = 5;
        type     = EntityType.Asteroid;

        body = new CircleBody(position, scale * (FixedPoint)0.5f, this);

        body.SetLayer(type);
        body.SetCollidesWith(EntityType.Ufo, true);
        body.SetCollidesWith(EntityType.Asteroid, true);
        body.SetCollidesWith(EntityType.Blast, true);
        body.SetCollidesWith(EntityType.Placeholder, true);

        behavior = new  AsteroidBehavior(this);
    }