void createObject() { if (self.World.Game.SharedRandom.NextDouble() > info.Probability) { return; } var height = self.Height + info.Offset.Z; switch (info.Type) { case SpawnPartTypes.ACTOR: var actor = ActorCache.Create(self.World, info.Name, randomPosition(), info.InheritsTeam ? self.Team : Actor.NeutralTeam, info.InheritsBot && self.IsBot); if (info.InheritsBot && self.IsBot) { actor.Bot.Target = self.Bot.Target; } actor.Height = height; self.World.Add(actor); break; case SpawnPartTypes.PARTICLE: var particle = ParticleCache.Create(self.World, info.Name, randomPosition(), self.Height + info.Offset.Z); particle.Height = height; self.World.Add(particle); break; case SpawnPartTypes.WEAPON: var weapon = WeaponCache.Create(self.World, info.Name, randomPosition(), self); weapon.Height = height; self.World.Add(weapon); break; default: return; } }
// Check all needed references void CheckReferences () { if (PlaygroundC.reference==null) PlaygroundC.reference = FindObjectOfType<PlaygroundC>(); if (PlaygroundC.reference==null) PlaygroundC.ResourceInstantiate("Playground Manager"); if (this.playgroundCache==null) this.playgroundCache = new PlaygroundCache(); if (this.particleCache==null) this.particleCache = new ParticleCache(); if (this.particleSystemGameObject==null) { this.particleSystemGameObject = gameObject; this.particleSystemTransform = transform; this.particleSystemRenderer = renderer; this.shurikenParticleSystem = particleSystemGameObject.GetComponent<ParticleSystem>(); } }