Exemple #1
0
    public Enemy(DevMath.Vector2 position)
    {
        visual        = Resources.Load <Texture2D>("pacman");
        Circle        = new DevMath.Circle();
        Circle.Radius = visual.width * .5f;

        Position = position;
    }
Exemple #2
0
    public Projectile(DevMath.Vector2 position, DevMath.Vector2 direction, float startVelocity, float acceleration)
    {
        visual = Resources.Load <Texture2D>("pacman");

        Circle = new DevMath.Circle {
            Position = position,
            Radius   = visual.width * .5f * SCALE
        };

        velocity = startVelocity;
        accelerationPerSecond = acceleration;

        Direction = direction;
    }
Exemple #3
0
    public Player()
    {
        visual = Resources.Load <Texture2D>("pacman");

        Circle        = new DevMath.Circle();
        Circle.Radius = visual.width * .5f;

        pixel = new Texture2D(1, 1, TextureFormat.RGBA32, false);
        pixel.SetPixel(0, 0, Color.white);
        pixel.Apply();

        Position = new DevMath.Vector2(Screen.width * .5f - visual.width * .5f, Screen.height * .5f - visual.height * .5f);

        rigidbody = new DevMath.Rigidbody()
        {
            mass            = 1.0f,
            force           = 150.0f,
            dragCoefficient = .47f
        };
    }
Exemple #4
0
 public bool CollidesWith(Circle circle)
 {
     return((circle.Position - Position).Magnitude <= circle.Radius + Radius);
 }