Skip to content

Instantly share code, notes, and snippets.

@Metapyziks
Created May 29, 2012 12:06
Show Gist options
  • Select an option

  • Save Metapyziks/2828078 to your computer and use it in GitHub Desktop.

Select an option

Save Metapyziks/2828078 to your computer and use it in GitHub Desktop.
using OpenTK;
using Zombles.Geometry;
using Zombles.Entities;
namespace Zombles.Scripts
{
public class CorePlugin : Plugin
{
private Entity myEnt;
protected override void OnInitialize()
{
Entity.Register( "human", delegate( City city )
{
Entity ent = Entity.Create( city );
Render r = ent.AddComponent<Render>();
r.Size = new Vector2( 0.5f, 1.0f );
r.SetTexture( "human_stand_s" );
return ent;
} );
}
protected override void OnCityGenerated()
{
City city = ( Game.CurrentScene as GameScene ).City;
myEnt = Entity.Create( "human", city );
myEnt.Position = new Vector3( city.Width / 2.0f, 0.0f, city.Height / 2.0f );
myEnt.Spawn();
}
protected override void OnThink( double dt )
{
myEnt.GetComponent<Render>().TextureIndex = (ushort) ( (int) ( Game.Time * 4.0 ) % 4 + 4 );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment