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;
- [Property]
- var MaxUses : Integer = 3;
- var Uses : Integer = 3;
- [Property]
- var CooldownValue : Real = 5.0;
- var Cooldown : Real = 0.0;
- [Property]
- var ArchetypeToSpawn : Archetype = null;
- function Initialize(init : CogInitializer)
- {
- this.Cooldown = this.CooldownValue;
- this.Uses = this.MaxUses;
- 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);
- Zero.Connect(this.Owner, Events.CollisionEnded, this.OnCollisionEnded);
- }
- function OnLogicUpdate(event : UpdateEvent)
- {
- this.Owner.SpriteText.Text = ("`this.Cooldown` `this.Timer`");
- var particles = this.Owner.FindChildByName("TombstoneParticles");
- if (this.Uses > 0)
- {
- particles.Transform.Translation = local Real3(0.0, 0.0, 0.0);
- }
- else
- {
- particles.Transform.Translation = local Real3(100000.0, 0.0, 0.0);
- }
- if(this.Uses != this.MaxUses)
- {
- this.Cooldown -= event.Dt;
- }
- if(this.Cooldown < 0.0)
- {
- if(this.Uses < this.MaxUses)
- {
- this.Uses += 1;
- }
- this.Cooldown = this.CooldownValue;
- }
- this.Timer += 1;
- }
- function CollisionPersisted (event : CollisionEvent)
- {
- var thingCollidedWith = event.OtherObject.Name;
- if(thingCollidedWith == "Ghost")
- {
- if (this.Timer > this.TimerMax)
- {
- this.Timer = this.TimerMax;
- }
- this.Timer -= 2;
- }
- if(thingCollidedWith == "Gravedigger")
- {
- //this.Timer += 1;
- }
- if (this.Timer < 0 && this.Uses > 0) //Spawn Zombie
- {
- var tombstones = this.Space.FindAllObjectsByName("Tombstone");
- this.Space.CreateAtPosition(this.ArchetypeToSpawn, this.Owner.Transform.Translation);
- this.Timer = this.TimerMax + 100;
- this.Uses -= 1;
- /*if (this.Uses == 0)
- {
- this.Uses -= 1;
- }*/
- this.Cooldown = this.CooldownValue;
- }
- }
- 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 = 0.1;
- player.PlayerController.Speed = player.PlayerController.SpeedMax;
- }
- }
- function OnCollisionEnded(event : CollisionEvent)
- {
- var thingCollidedWith = event.OtherObject;
- if(thingCollidedWith.Name == "Ghost")
- {
- this.Timer = this.TimerMax + 100;
- }
- }
- }
- On Wed, Jul 15, 2015 at 3:11 PM, Max Whitehead <max.blackllama@gmail.com> wrote:
- On Wed, Jul 15, 2015 at 3:01 PM, Isaac Dugaw <izpdugaw@gmail.com> wrote:
- On Wed, Jul 15, 2015 at 2:52 PM, Isaac Dugaw <izpdugaw@gmail.com> wrote:
- re-updated tombstone code:
- http://pastebin.com/WHaA3TwZ
- On Wed, Jul 15, 2015 at 2:12 PM, Isaac Dugaw <izpdugaw@gmail.com> wrote:
- Updated Tombstone Code:
- http://pastebin.com/Vf4M7kjf
- On Wed, Jul 15, 2015 at 1:58 PM, Isaac Dugaw <izpdugaw@gmail.com> wrote:
- Updated Torch Code:
- http://pastebin.com/bKr2DgL3
- On Wed, Jul 15, 2015 at 1:44 PM, Max Whitehead <max.blackllama@gmail.com> wrote:
- 2015-07-15 13:38 GMT-07:00 Isaac Dugaw <izpdugaw@gmail.com>:
- 2015-07-15 13:36 GMT-07:00 Isaac Dugaw <izpdugaw@gmail.com>:
- On Wed, Jul 15, 2015 at 1:24 PM, Isaac Dugaw <izpdugaw@gmail.com> wrote:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement