public Collector(int idNumber) : base() { id = idNumber; position = new Vector2( Randomizer.RandomInt(spawnBuffer, (int)ScreenManager.window.X - spawnBuffer), Randomizer.RandomInt(spawnBuffer, (int)ScreenManager.window.Y - spawnBuffer) ); display = Randomizer.RandomDisplay(); normalCapacity = capacity; dampening = 0.9f; heartbeatSchedule = new Schedualizer(0f, 5f, 5f); scale = 0.3f; targetScale = scale; teamColour = TeamColour.Get(); SetupAnimations(); SendHeartbeat(); audioTimeout.Elapsed += new ElapsedEventHandler(audioTimeout_Elapsed); Audio.Play("collector.spawn", display); users = new List <User>(); projectiles = new List <Projectile>(); }
public void MergeWith(Collector other) { poofAnim.Play(0); Audio.Play("collector.merge", display); OrderedDictionary o = new OrderedDictionary(); o.Add("team_1", id); o.Add("team_2", other.id); EventManager.Emit("collector:merge", o); capacity += (int)(other.capacity * 0.5); collected += (int)(other.collected * 0.5); collectRadius += (int)(other.collectRadius * 0.5f); targetScale += (other.scale * 0.3f); numCollectors += other.numCollectors; foreach (User u in other.users) { u.collector = this; users.Add(u); } health = 100; TeamColour.Put(other.teamColour); CollectorManager.Remove(other); }
protected override void Initialize() { ScreenManager.Initialize(this, graphics.GraphicsDevice); ContentManager.Initialize(this); EventManager.Initialize(); GridManager.Initialize(10); Audio.Initialize(); server = new Server(); worldManager = new WorldManager(this); worldManager.DrawOrder = 1; Components.Add(worldManager); resourceManager = new ResourceManager(this, worldManager); resourceManager.DrawOrder = 2; Components.Add(resourceManager); wormholeManager = new WormholeManager(this); wormholeManager.DrawOrder = 3; Components.Add(wormholeManager); collectorManager = new CollectorManager(this); collectorManager.DrawOrder = 4; Components.Add(collectorManager); enemyManager = new EnemyManager(this); enemyManager.DrawOrder = 5; Components.Add(enemyManager); userManager = new UserManager(this); userManager.DrawOrder = 6; Components.Add(userManager); TeamColour.Initialize(); VLine.Effect = new BasicEffect(GraphicsDevice); beautyPass = ContentManager.Shader("BeautyRender"); noiseTexture = Content.Load <Texture2D>(@"images/noise"); beautyPass.CurrentTechnique = beautyPass.Techniques["Pretty"]; beautyPass.Parameters["TextureSize"].SetValue(ScreenManager.window); beautyPass.Parameters["NoiseMap"].SetValue(noiseTexture); oldState = Keyboard.GetState(); spriteBatch = new SpriteBatch(GraphicsDevice); for (int i = 0; i < 4; i++) { tmpTargets[i] = new RenderTarget2D(ScreenManager.graphics, 1280, 800, false, ScreenManager.graphics.PresentationParameters.BackBufferFormat, DepthFormat.Depth24, 8, RenderTargetUsage.PreserveContents); } base.Initialize(); }
protected void SendHeartbeat() { OrderedDictionary o = new OrderedDictionary(); o.Add("id", id); o.Add("health", health); o.Add("capacity", capacity); o.Add("fill", collected); o.Add("colour", TeamColour.ToHex(teamColour, true)); EventManager.Emit("collector:heartbeat", o); }
public void PortalDie() { if (!isDying) { Die(); portalAnim.WhenFinished(() => { TeamColour.Put(teamColour); CollectorManager.Remove(this); }); collectorAnim.Play((int)States.Outro1 + damage); portalAnim.Play(0); } }
public void ExplodeDie() { if (!isDying) { Die(); explodeAnim.WhenFinished(() => { TeamColour.Put(teamColour); CollectorManager.Remove(this); }); Audio.Play("collector.bass", 4); collectorAnim.Play((int)States.Exploding); collectorAnim.frameOffset = new Vector2(50, 137); explodeAnim.Play(0); } }