mirror of
https://github.com/Memorix101/UnityXNA/
synced 2024-12-30 15:25:35 +01:00
The XNA 4.0 PlatformerGame sample is successfully running inside Unity3D 3.5. Implemented a basic game loop, game timing, content loading for Texture2D, SoundEffect and Song. Emulated SpriteBatch drawing for sprites and strings (note SpriteFont is not yet supported to all strings are rendered using the default GUI label font). Songs can be played using an AudioSource attached to the XNATest game object which acts as an emulator for MediaPlayer. Playing a SoundEffect creates a game object with an AudioSource attached which is automatically deleted when the sound finishes. Implemented keyboard input with a limited set of XNA Keys mapping to Unity3D KeyCodes.
65 lines
1.2 KiB
C#
65 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
|
|
class DrawSpriteCall
|
|
{
|
|
private Texture2D texture2D;
|
|
private Vector2 position;
|
|
private Nullable<Rectangle> source;
|
|
private Vector4 color;
|
|
private Vector2 origin;
|
|
private SpriteEffects spriteEffects;
|
|
|
|
public Texture2D Texture2D {
|
|
get {
|
|
return this.texture2D;
|
|
}
|
|
}
|
|
|
|
public Vector2 Position {
|
|
get {
|
|
return this.position;
|
|
}
|
|
}
|
|
|
|
public Nullable<Rectangle> Source {
|
|
get {
|
|
return this.source;
|
|
}
|
|
}
|
|
|
|
public Vector4 Color {
|
|
get {
|
|
return this.color;
|
|
}
|
|
}
|
|
|
|
public Vector2 Origin {
|
|
get {
|
|
return this.origin;
|
|
}
|
|
}
|
|
|
|
public SpriteEffects SpriteEffects {
|
|
get {
|
|
return this.spriteEffects;
|
|
}
|
|
}
|
|
|
|
public DrawSpriteCall(Texture2D texture2D, Vector2 position, Nullable<Rectangle> source, Vector4 color, Vector2 origin, SpriteEffects spriteEffects)
|
|
{
|
|
// TODO: Complete member initialization
|
|
this.texture2D = texture2D;
|
|
this.position = position;
|
|
this.source = source;
|
|
this.color = color;
|
|
this.origin = origin;
|
|
this.spriteEffects = spriteEffects;
|
|
}
|
|
|
|
}
|