Guest User

Untitled

a guest
Jul 10th, 2016
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 1.72 KB | None | 0 0
  1. import gg.zue.entity.prototyper.EntityDefinition
  2.  
  3. /**
  4.  * Created by Michael Zuegg on 10.07.2016.
  5.  */
  6. class BaseConfig extends EntityDefinition {
  7.     @Override
  8.     void onLoad() {
  9.         Type("Base") {
  10.             Components(
  11.                     Component(PositionComponent.class) {
  12.                         //No Default Parameters
  13.                     }
  14.             )
  15.         }
  16.  
  17.         Type("Damageable") {
  18.             Components(
  19.                     Component(LifeComponent.class) {
  20.                         health=100; //Default Parameters
  21.                         maxHealth=100;
  22.                     }
  23.             )
  24.         }
  25.  
  26.         /**
  27.          * Has now Postion and Life with the default parameters
  28.          */
  29.         Type("Human"){
  30.             Extends("Base","Damageable")
  31.         }
  32.  
  33.         Type("Mike"){
  34.             Extends("Human")
  35.         }
  36.  
  37.  
  38.         /**
  39.          * Same as Mike, but with increased maxHealth
  40.          */
  41.         Type("Peter"){
  42.             Extends("Human")
  43.             Components(
  44.                     Component(LifeComponent.class){
  45.                         maxHealth=200; //Does now have health=100 and maxHealth=200;
  46.                     }
  47.             )
  48.         }
  49.  
  50.         //Same as every humand, but with removed LifeComponent
  51.         Type("God"){
  52.             Extends("Humand")
  53.             RemoveComponents(LifeComponent.class)
  54.         }
  55.  
  56.         /**
  57.          * Removes the PositionComponent form this entity AND
  58.          * all entities extending from it so even God would
  59.          * be left without position (Could be usefull for supporting mods)
  60.          */
  61.  
  62.         UpdateType("BaseUnit") {
  63.             RemoveComponents(PositionComponent.class)
  64.         }
  65.     }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment