I'll explain it all in detail in future posts.
Example of a typical GuayScript script
// // Health script. Makes a GameObject to have 'life' // 'Implements' the HealthInterface interface // public class Health : GuayScript { GameObject OtherGameObject; public float MaxCapacity; public float Amount; public Health() { var dead = false; var currentHealth = Amount; OnAwake = _properties => { Messages[ HealthInterface.CmdIncrease ] = ( _id, _args ) => currentHealth += _args.Get(); Messages[ HealthInterface.CmdDecrease ] = ( _id, _args ) => currentHealth -= _args.Get (); Messages[ HealthInterface.CmdRefill ] = ( _id, _args ) => currentHealth = MaxCapacity; Messages[ HealthInterface.CmdDie ] = ( _id, _args ) => currentHealth = 0; }; OnUpdate = _deltaTime => { if( dead ) return; if( currentHealth <= 0 ) { dead = true; // components say interesting things through the Notify function Notify( HealthInterface.EvDead ); // components can also say interesting things to other objects OtherGameObject.Send( HealthInterface.EvDead ); } }; } }
No comments :