public override void damage(float by, Gun.Ammo type) { base.damage(by, type); drop_damage += by; if (drop_damage > orphan_drop_damage && state == State.CAST) { for (int i = 0; i < 2; i++) { var o = new Orphan(Vector2.zero); Game.instance.orphan_group.add(o); o.enterWorld(bubblePosition(i)); Particle pop = new Particle(AppMain.textures.skeletonkingprojectile.atlas); pop.frame = 5; pop.loop = false; pop.loop_end = 6; pop.frame_speed = 0.05f; pop.position = bubblePosition(i); Game.instance.particle_manager.add(pop); } state = State.IDLE; idle_timeout = Util.rng.Next(idle_time_min, idle_time_max); } }
void CheckWeaponConflict(Gun.Ammo weapon, HashSet <int> generatedWeapons) { switch (weapon) { case Gun.Ammo.DRAGON: generatedWeapons.Add((int)Gun.Ammo.FLAME); break; case Gun.Ammo.FLAME: generatedWeapons.Add((int)Gun.Ammo.DRAGON); break; case Gun.Ammo.IGLOO: generatedWeapons.Add((int)Gun.Ammo.FORK); break; case Gun.Ammo.FORK: generatedWeapons.Add((int)Gun.Ammo.IGLOO); break; case Gun.Ammo.SKULL: generatedWeapons.Add((int)Gun.Ammo.BOUNCE); break; case Gun.Ammo.BOUNCE: generatedWeapons.Add((int)Gun.Ammo.SKULL); break; case Gun.Ammo.VEGETABLE: generatedWeapons.Add((int)Gun.Ammo.BOOMERANG); break; case Gun.Ammo.BOOMERANG: generatedWeapons.Add((int)Gun.Ammo.VEGETABLE); break; case Gun.Ammo.LIGHTNING: generatedWeapons.Add((int)Gun.Ammo.SIN); break; case Gun.Ammo.SIN: generatedWeapons.Add((int)Gun.Ammo.LIGHTNING); break; } }
public override void damage(float by, Gun.Ammo type) { drop_damage += by; if (drop_damage > orphan_drop_damage && held_orphans.Count > 0) { releaseOrphans(); } base.damage(by, type); }
public override void damage(float by, Gun.Ammo type) { drop_damage += by; base.damage(by, type); if (n_apples > 0 && hp < max_hp * (n_apples - 1) / 5) { n_apples--; Game.instance.enemy_bullet_group.add(new ExplodingApple(position + apples[n_apples] + new Vector2(-20, 30))); } }
public Explosion(Vector2 position_, Vector2 velocity_, float size_, int damage_, Gun.Ammo type_) { position = position_; velocity = velocity_; radius = size_ / 2; size = new Vector2(size_ / AppMain.textures.explosion.sprites[0].size.x, size_ / AppMain.textures.explosion.sprites[0].size.y); damage = damage_; type = type_; target_group = Game.instance.enemy_group; }
public static void DefeatedWithAmmo(Gun.Ammo ammo) { if (!IsActiveTask(TaskType.DEFEAT_ENEMIES_WITH_GUN)) { return; } if (ammo != defeatWithGun) { return; } currentAmountDefeated++; }
public override void damage(float by, Gun.Ammo type) { drop_damage += by; //Console.WriteLine("{0}/{1} {2} {3}", hp, max_hp, max_hp*1/3, max_hp*2/3); base.damage(by, type); if (hp < max_hp * 2 / 3 && face1_die_frame == -1) { face1_die_frame = 0; } if (hp < max_hp * 1 / 3 && face2_die_frame == -1) { face2_die_frame = 0; } }
public static void FireGun(Gun.Ammo ammo) { if (!IsActiveTask(TaskType.SEND_OUT_THREE_GUNS)) { return; } if (ammo != ammoGunToSend) { return; } currentAmountOfGunsSent++; }
public static void FireSpecial(Gun.Ammo ammo) { if (!IsActiveTask(TaskType.SEND_OUT_THREE_SPECIALS)) { return; } if (ammo != ammoSpecialToSend) { return; } currentAmountOfSpecialsSent++; }
public virtual void damage(float by, Gun.Ammo type) { if (hp <= 0) { return; } max_hp = max_hp == 0 ? hp : max_hp; float amt = (by * Gun.UpgradeMultiplier(type)); if (!Target.damages.ContainsKey(type)) { Target.damages[type] = 0; } Target.damages[type] += amt; hp -= amt; if (hp <= 0) { releaseOrphans(); for (int i = 0; i < skulls.Count; ++i) { skulls[i].explosion_timeout = 0; } frozen = 0; spiked = 0; startDying(); Game.instance.house.addScore((int)max_hp, position); remove = true; Game.instance.dead_group.add(this); Objectives.DefeatedWithAmmo(type); } if (flash_timeout <= 0) { flashing = House.flash_length; float health = hp / (float)max_hp; flash_timeout = (int)(health * House.flash_max_timeout + (1 - health) * House.flash_min_timeout); } }
Color AmmoColor(Gun.Ammo ammo) { switch (ammo) { case Gun.Ammo.DRAGON: case Gun.Ammo.FLAME: return(new Color(1.0f, 0.7f, 0.1f, 1)); case Gun.Ammo.IGLOO: case Gun.Ammo.FORK: return(new Color(0.1f, 0.5f, 1.0f, 1)); case Gun.Ammo.SKULL: case Gun.Ammo.BOUNCE: return(new Color(0.8f, 0.2f, 0.7f, 1)); case Gun.Ammo.VEGETABLE: case Gun.Ammo.BOOMERANG: return(new Color(0.4f, 0.8f, 0.3f, 1)); case Gun.Ammo.LIGHTNING: case Gun.Ammo.SIN: return(new Color(1.0f, 0.3f, 0.3f, 1)); } return(Color.white); }
public Target findClosest(Vector2 to, Gun.Ammo type = Gun.Ammo.NONE, int min_distance = 100) { Target closest = null; float distance = 0; for (int i = 0; i < entities.Count; ++i) { Target t = (Target)entities[i]; if (type != Gun.Ammo.NONE) { continue; } if (t.hp < 0 || t.remove || t.position.x > 1000) { continue; } if ((t.position - to).sqrMagnitude < min_distance * min_distance) { continue; } if (closest == null || (t.position - to).sqrMagnitude < distance && t.hp > 0) { closest = t; distance = (float)(t.position - to).sqrMagnitude; } } if (type != Gun.Ammo.NONE && closest == null) { return(findClosest(to, Gun.Ammo.NONE, min_distance)); } return(closest); }
public void SpawnFloatyText(int amount, float multiplier, Vector2 position, float size, Gun.Ammo ammo) { root.SetActive(true); for (int i = 0; i < texts.Length; ++i) { if (texts[i].gameObject.activeInHierarchy) { continue; } texts[i].gameObject.SetActive(true); AppMain.MainMenu.builder.Length = 0; AppMain.MainMenu.builder.AppendFormat("+{0}", amount); if (multiplier > 1) { AppMain.MainMenu.builder.AppendFormat("x{0}", multiplier); } texts[i].fontSize = fontSize * size * 0.6f; texts[i].SetText(AppMain.MainMenu.builder); texts[i].color = AmmoColor(ammo); /* calculate position from old point system */ { if (position.x > 270) { texts[i].alignment = TextAlignmentOptions.Left; texts[i].rectTransform.pivot = new Vector2(0, 0.5f); position.x = 410; } else if (position.x > 70) { texts[i].alignment = TextAlignmentOptions.Right; texts[i].rectTransform.pivot = new Vector2(1, 0.5f); position.x = 930; } if (position.y > 400) { position.y = -250; } else if (position.y > 270) { position.y = 10; } else { position.y = 250; } } texts[i].rectTransform.SetXY(position.x, position.y); LeanTween.moveLocalY(texts[i].gameObject, position.y + 100, 5).setEase(LeanTweenType.easeOutSine); LeanTween.value(gameObject, (Action <float, object>)ChangeAlpha, 1, 0, 5) .setOnUpdateParam(i as object) .setOnComplete(() => { texts[i].gameObject.SetActive(false); }); break; } }
public override void damage(float hp, Gun.Ammo type) { drdog.damage(hp, type); }
public override void damage(float by, Gun.Ammo type) { drop_damage += by; base.damage(by, type); }