Created
May 29, 2012 12:06
-
-
Save Metapyziks/2828078 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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