Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Tombstone : ZilchComponent
- {
- [Property]
- var TimerMax : Integer = 100;
- var Timer : Integer = 0;
- //var IsFilled : Boolean = true;
- [Property]
- var ArchetypeToSpawn : Archetype = null;
- function Initialize(init : CogInitializer)
- {
- this.Timer = this.TimerMax;
- Zero.Connect(this.Owner, Events.CollisionPersisted, this.CollisionPersisted);
- Zero.Connect(this.Space, Events.LogicUpdate, this.OnLogicUpdate);
- Zero.Connect(this.Owner, Events.CollisionStarted, this.OnCollisionStarted);
- }
- function OnLogicUpdate(event : UpdateEvent)
- {
- this.Owner.SpriteText.Text = ("`this.Timer`");
- }
- function CollisionPersisted (event : CollisionEvent)
- {
- var thingCollidedWith = event.OtherObject.Name;
- if(thingCollidedWith == "Ghost")
- {
- this.Timer -= 2;
- }
- if(thingCollidedWith == "Gravedigger")
- {
- this.Timer += 3;
- if (this.Timer > this.TimerMax)
- {
- this.Timer = this.TimerMax;
- }
- }
- if (this.Timer < 0/* && this.IsFilled */)
- {
- this.Space.CreateAtPosition(this.ArchetypeToSpawn, this.Owner.Transform.Translation);
- //this.IsFilled = false;
- this.Timer = this.TimerMax;
- }
- }
- function OnCollisionStarted(event : CollisionEvent)
- {
- var thingCollidedWith = event.OtherObject;
- if(thingCollidedWith.Name == "Zombie" && thingCollidedWith.ZombiePathing.IsPickedUp == true)
- {
- var player = this.Space.FindObjectByName("Gravedigger");
- thingCollidedWith.Destroy();
- //this.IsFilled = true;
- this.Timer = this.TimerMax;
- player.GraveDiggerPickup.IsCarrying = false;
- player.GraveDiggerPickup.DropDelay = 1.0;
- player.PlayerController.Speed = 5.0;
- }
- }
- }
- On Mon, Jul 13, 2015 at 2:07 PM, Isaac Dugaw <izpdugaw@gmail.com> wrote:
- On Mon, Jul 13, 2015 at 1:49 PM, Scott Cyra <scottcyra@gmail.com> wrote:
- On Mon, Jul 13, 2015 at 1:40 PM, Isaac Dugaw <izpdugaw@gmail.com> wrote:
- http://pastebin.com/zi6dHtTL
- --
- >: )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement