C# Class SmashBros.Controllers.ImageController

ImageController Controls one image but can have many positions And different animations on differente positions
Inheritance: Controller
显示文件 Open project: Grutn/TDT4240-X2 Class Usage Examples

Public Properties

Property Type Description
OriginDefault Vector2
ScaleDefault float

Public Methods

Method Description
AddPosition ( Vector2 pos, int posId = -1 ) : ImageModel
AddPosition ( float x, float y, int posId = -1 ) : ImageModel
Animate ( ImageModel model, Vector2 toPos, float timeInMs, bool loop, float toScale = 1f ) : void
Animate ( ImageModel model, float toX, float toY, float timeInMs, bool loop = false, float toScale = 1f ) : void

Animates texture at positionIndex

Animate ( float toX, float toY, float timeInMs, bool loop = false, float scale = 1f ) : void
Animate ( int posIndex, Vector2 toPos, float timeInMs, bool loop = false, float scale = 1f ) : void
Animate ( int posIndex, float toX, float toY, float timeInMs, bool loop = false, float scale = 1f ) : void
AnimateFrame ( ImageModel model, int startFrame, int endFrame, int fps, bool loop = true ) : void
AnimatePos ( ImageModel model, float toX, float toY, float timeInMs, bool loop = false ) : void

Annimates the given model to the given position(x,y)

AnimatePos ( float toX, float toY, float timeInMs, bool loop = false ) : void

Anniates the first model (if exists) instance to given position(x,y)

AnimateScale ( ImageModel model, float toScale, float timeInMs, bool loop = false ) : void

Annimates the given model to the given scale

AnimateScale ( float toScale, float timeInMs, bool loop = false ) : void

Anniates the first model(if exists) instance to given scale

AnimateScale ( int posIndex, float scale, float time, bool loop = false ) : void
Deactivate ( ) : void
EmptyList ( ) : void
GetAt ( int index ) : ImageModel

Gets the model at index

ImageController ( ScreenManager screen, string assetName, Vector2 pos, int layer, bool staticPosition = false ) : System
ImageController ( ScreenManager screen, string assetName, int layer, bool staticPosition = false ) : System
Load ( Microsoft.Xna.Framework.Content.ContentManager content ) : void
OnNext ( GameStateManager value ) : void
RemoveId ( int id ) : void
RemovePosition ( ImageModel pos ) : void
RemovePosition ( int index ) : void
SetFps ( ImageModel model, int fps ) : void
SetFps ( int fps ) : void

Sets frames per second for first instance in models

SetFrame ( ImageModel model, int frame ) : void

Set current frame at given image model

SetFrame ( int frame ) : void

Set frame at first instance in model list if exists

SetFrameRectangle ( int widht, int height ) : void
SetPosition ( Vector2 pos ) : ImageModel

Remove all other image models and create new model with position

SetPosition ( int x, int y ) : ImageModel

Remove all other image models and create new model with position

Unload ( ) : void
Update ( GameTime gameTime ) : void

Private Methods

Method Description
updateAnimation ( GameTime gameTime, ImageModel model ) : bool

Method Details

AddPosition() public method

public AddPosition ( Vector2 pos, int posId = -1 ) : ImageModel
pos Vector2
posId int
return SmashBros.Models.ImageModel

AddPosition() public method

public AddPosition ( float x, float y, int posId = -1 ) : ImageModel
x float
y float
posId int
return SmashBros.Models.ImageModel

Animate() public method

public Animate ( ImageModel model, Vector2 toPos, float timeInMs, bool loop, float toScale = 1f ) : void
model SmashBros.Models.ImageModel
toPos Vector2
timeInMs float
loop bool
toScale float
return void

Animate() public method

Animates texture at positionIndex
public Animate ( ImageModel model, float toX, float toY, float timeInMs, bool loop = false, float toScale = 1f ) : void
model SmashBros.Models.ImageModel
toX float
toY float
timeInMs float Time to use to animate
loop bool
toScale float
return void

Animate() public method

public Animate ( float toX, float toY, float timeInMs, bool loop = false, float scale = 1f ) : void
toX float
toY float
timeInMs float
loop bool
scale float
return void

Animate() public method

public Animate ( int posIndex, Vector2 toPos, float timeInMs, bool loop = false, float scale = 1f ) : void
posIndex int
toPos Vector2
timeInMs float
loop bool
scale float
return void

Animate() public method

public Animate ( int posIndex, float toX, float toY, float timeInMs, bool loop = false, float scale = 1f ) : void
posIndex int
toX float
toY float
timeInMs float
loop bool
scale float
return void

AnimateFrame() public method

public AnimateFrame ( ImageModel model, int startFrame, int endFrame, int fps, bool loop = true ) : void
model SmashBros.Models.ImageModel
startFrame int
endFrame int
fps int
loop bool
return void

AnimatePos() public method

Annimates the given model to the given position(x,y)
public AnimatePos ( ImageModel model, float toX, float toY, float timeInMs, bool loop = false ) : void
model SmashBros.Models.ImageModel
toX float
toY float
timeInMs float
loop bool
return void

AnimatePos() public method

Anniates the first model (if exists) instance to given position(x,y)
public AnimatePos ( float toX, float toY, float timeInMs, bool loop = false ) : void
toX float
toY float
timeInMs float
loop bool
return void

AnimateScale() public method

Annimates the given model to the given scale
public AnimateScale ( ImageModel model, float toScale, float timeInMs, bool loop = false ) : void
model SmashBros.Models.ImageModel
toScale float
timeInMs float
loop bool
return void

AnimateScale() public method

Anniates the first model(if exists) instance to given scale
public AnimateScale ( float toScale, float timeInMs, bool loop = false ) : void
toScale float
timeInMs float
loop bool
return void

AnimateScale() public method

public AnimateScale ( int posIndex, float scale, float time, bool loop = false ) : void
posIndex int
scale float
time float
loop bool
return void

Deactivate() public method

public Deactivate ( ) : void
return void

EmptyList() public method

public EmptyList ( ) : void
return void

GetAt() public method

Gets the model at index
public GetAt ( int index ) : ImageModel
index int
return SmashBros.Models.ImageModel

ImageController() public method

public ImageController ( ScreenManager screen, string assetName, Vector2 pos, int layer, bool staticPosition = false ) : System
screen SmashBros.MySystem.ScreenManager
assetName string
pos Vector2
layer int
staticPosition bool
return System

ImageController() public method

public ImageController ( ScreenManager screen, string assetName, int layer, bool staticPosition = false ) : System
screen SmashBros.MySystem.ScreenManager
assetName string
layer int
staticPosition bool
return System

Load() public method

public Load ( Microsoft.Xna.Framework.Content.ContentManager content ) : void
content Microsoft.Xna.Framework.Content.ContentManager
return void

OnNext() public method

public OnNext ( GameStateManager value ) : void
value GameStateManager
return void

RemoveId() public method

public RemoveId ( int id ) : void
id int
return void

RemovePosition() public method

public RemovePosition ( ImageModel pos ) : void
pos SmashBros.Models.ImageModel
return void

RemovePosition() public method

public RemovePosition ( int index ) : void
index int
return void

SetFps() public method

public SetFps ( ImageModel model, int fps ) : void
model SmashBros.Models.ImageModel
fps int
return void

SetFps() public method

Sets frames per second for first instance in models
public SetFps ( int fps ) : void
fps int
return void

SetFrame() public method

Set current frame at given image model
public SetFrame ( ImageModel model, int frame ) : void
model SmashBros.Models.ImageModel
frame int
return void

SetFrame() public method

Set frame at first instance in model list if exists
public SetFrame ( int frame ) : void
frame int
return void

SetFrameRectangle() public method

public SetFrameRectangle ( int widht, int height ) : void
widht int
height int
return void

SetPosition() public method

Remove all other image models and create new model with position
public SetPosition ( Vector2 pos ) : ImageModel
pos Vector2
return SmashBros.Models.ImageModel

SetPosition() public method

Remove all other image models and create new model with position
public SetPosition ( int x, int y ) : ImageModel
x int
y int
return SmashBros.Models.ImageModel

Unload() public method

public Unload ( ) : void
return void

Update() public method

public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
return void

Property Details

OriginDefault public_oe property

Default origin point
public Vector2 OriginDefault
return Vector2

ScaleDefault public_oe property

Default scale when add a position
public float ScaleDefault
return float