Advertisement
Guest User

Untitled

a guest
Jul 13th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. class Tombstone : ZilchComponent
  2. {
  3.  
  4. [Property]
  5. var TimerMax : Integer = 100;
  6.  
  7. var Timer : Integer = 0;
  8.  
  9. //var IsFilled : Boolean = true;
  10.  
  11. [Property]
  12. var ArchetypeToSpawn : Archetype = null;
  13.  
  14. function Initialize(init : CogInitializer)
  15. {
  16. this.Timer = this.TimerMax;
  17.  
  18. Zero.Connect(this.Owner, Events.CollisionPersisted, this.CollisionPersisted);
  19. Zero.Connect(this.Space, Events.LogicUpdate, this.OnLogicUpdate);
  20. Zero.Connect(this.Owner, Events.CollisionStarted, this.OnCollisionStarted);
  21. }
  22.  
  23. function OnLogicUpdate(event : UpdateEvent)
  24. {
  25. this.Owner.SpriteText.Text = ("`this.Timer`");
  26. }
  27.  
  28. function CollisionPersisted (event : CollisionEvent)
  29. {
  30. var thingCollidedWith = event.OtherObject.Name;
  31.  
  32. if(thingCollidedWith == "Ghost")
  33. {
  34. this.Timer -= 2;
  35. }
  36.  
  37. if(thingCollidedWith == "Gravedigger")
  38. {
  39. this.Timer += 3;
  40. if (this.Timer > this.TimerMax)
  41. {
  42. this.Timer = this.TimerMax;
  43. }
  44. }
  45.  
  46. if (this.Timer < 0/* && this.IsFilled */)
  47. {
  48. this.Space.CreateAtPosition(this.ArchetypeToSpawn, this.Owner.Transform.Translation);
  49. //this.IsFilled = false;
  50.  
  51. this.Timer = this.TimerMax;
  52. }
  53. }
  54.  
  55. function OnCollisionStarted(event : CollisionEvent)
  56. {
  57. var thingCollidedWith = event.OtherObject;
  58.  
  59. if(thingCollidedWith.Name == "Zombie" && thingCollidedWith.ZombiePathing.IsPickedUp == true)
  60. {
  61. var player = this.Space.FindObjectByName("Gravedigger");
  62.  
  63. thingCollidedWith.Destroy();
  64.  
  65. //this.IsFilled = true;
  66.  
  67. this.Timer = this.TimerMax;
  68.  
  69. player.GraveDiggerPickup.IsCarrying = false;
  70. player.GraveDiggerPickup.DropDelay = 1.0;
  71. player.PlayerController.Speed = 5.0;
  72. }
  73. }
  74.  
  75. }
  76.  
  77.  
  78. On Mon, Jul 13, 2015 at 2:07 PM, Isaac Dugaw <izpdugaw@gmail.com> wrote:
  79.  
  80.  
  81. On Mon, Jul 13, 2015 at 1:49 PM, Scott Cyra <scottcyra@gmail.com> wrote:
  82.  
  83.  
  84. On Mon, Jul 13, 2015 at 1:40 PM, Isaac Dugaw <izpdugaw@gmail.com> wrote:
  85. http://pastebin.com/zi6dHtTL
  86.  
  87.  
  88.  
  89. --
  90.  
  91.  
  92.  
  93. >: )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement