public override void hitWall() { wallbounces--; if (wallbounces < 0) { removeMe = true; } AudioSet lucyLaser = world.tileEngine.resourceComponent.getAudioSet("027_LucyLaser"); world.tileEngine.audioComponent.playSound(lucyLaser[1], false); }
public LaserArrow(GameWorld world, Vector2 position, Vector2 direction) : base(world, position, direction, 8, Constants.WORLD2MODEL_LASERARROW, Actor.indexFromDirection(direction, 24, .25f) % 12) { anim = null; myBehavior = new LaserArrowBehavior(this); active = true; frictionCoefficient = 0.0001f; elasticity = 1.0f; mass = 1; damage = 15; this.setGlow(2.0f); // MASKING this.actorcategory = ActorCategory.friendlyprojectile; this.collisionmask = ActorCategory.enemy; textureSet = world.tileEngine.resourceComponent.getTextureSet("027_LaserArrow"); AudioSet lucyLaser = world.tileEngine.resourceComponent.getAudioSet("027_LucyLaser"); world.tileEngine.audioComponent.playSound(lucyLaser[0], false); }
void Start() { for (int i = 0; i < 3; i++) { map[i] = new AudioSet("map" + i.ToString(), gameObject); } shot1 = new AudioSet("shot1", gameObject); amulet = new AudioSet("amulet", gameObject); fall = new AudioSet("fall", gameObject); attackLight = new AudioSet("attackLight", gameObject); attackHeavy = new AudioSet("attackHeavy", gameObject); death = new AudioSet("death", gameObject); hitLight = new AudioSet("hitLight", gameObject); hitHeavy = new AudioSet("hitHeavy", gameObject); item = new AudioSet("item", gameObject); gameStart = new AudioSet("gameStart", gameObject); cursor1 = new AudioSet("cursor1", gameObject); cursor2 = new AudioSet("cursor2", gameObject); charge = new AudioSet("charge", gameObject); shot2 = new AudioSet("shot2", gameObject); }
public static void Play(AudioSet audio) { audio.Play(); }
private Vector2 chargeForce; // Force to use while charging public MrHammerBehavior(Actor actor, Actor target) : base(actor) { this.actor = actor; this.target = target; this.pathFindBehavior = new PathfindBehavior(actor, target, Constants.MRHAMMER_PATHFIND); this.shotCooldown = 0; this.lockCooldown = 0; this.chargeCount = 480; this.chargeTimeOut = 0; this.isCharging = false; // Define animation actions // Hammer attack Animation.Action beginSmash = (frame) => { actor.world.tileEngine.audioComponent.playSound(actor.audioSet[0], false); }; Animation.Action smash = (frame) => { //Spawn explosions // Outer Outer Ring for (int i = 0; i < 30; i++) { Vector2 rotated = Vector2.Transform(new Vector2(0f, 4f), Matrix.CreateRotationZ(MathHelper.ToRadians(12 * i))); actor.world.addActor(new Explosion(actor.world as GameWorld, actor.position + rotated * (actor.size / 3 + 5), rotated * 4f)); } // Outer Ring for (int i = 0; i < 18; i++) { Vector2 rotated = Vector2.Transform(new Vector2(0f, 3f), Matrix.CreateRotationZ(MathHelper.ToRadians(20 * i))); actor.world.addActor(new Explosion(actor.world as GameWorld, actor.position + rotated * (actor.size / 3 + 5), rotated * 4f)); } // Inner Ring for (int i = 0; i < 9; i++) { Vector2 rotated = Vector2.Transform(new Vector2(0f, 2f), Matrix.CreateRotationZ(MathHelper.ToRadians(40 * i))); actor.world.addActor(new Explosion(actor.world as GameWorld, actor.position + rotated * (actor.size / 3 + 5), rotated * 4f)); } //Determine which actors are hit foreach (Actor a in actor.getConeAround(100, new Vector2(0, 0), 360, null)) { ILife liveAct = a as ILife; Vector2 impulse = new Vector2(); impulse = a.position - this.actor.position; impulse.Normalize(); impulse *= Constants.MRHAMMER_KNOCKBACK; if (a.collisionimmunitymask != Actor.ActorCategory.enemy) { if (liveAct != null) { liveAct.life.life -= Constants.MRHAMMER_HAMMER_DAMAGE; } } a.addImpulse(impulse); } // Play explosion sound AudioSet temp = actor.world.tileEngine.resourceComponent.getAudioSet("020_FirePillar"); actor.world.tileEngine.audioComponent.playSound(temp[0], false); }; // Charge attack Animation.Action castStunWarning = frame => { actor.world.addActor(new StunWarning(actor.world as GameWorld, target.position, new Vector2(0, 0))); }; Animation.Action castCircle = frame => { // Ring of Icy Stun int randomHole = (actor.world as GameWorld).tileEngine.randGen.Next(0, 9); for (int i = 0; i < 9; i++) { // Spawn ice ball unless it's the one being left out Vector2 rotated = Vector2.Transform(new Vector2(0f, 2f), Matrix.CreateRotationZ(MathHelper.ToRadians(40 * i))); if (i != randomHole) { actor.world.addActor(new MagicPrimary(actor.world as GameWorld, target.position + rotated * (actor.size / 3 + 8), rotated * 4f)); } } // Initiate charge pathFindBehavior.run(); isCharging = true; chargeForce = actor.force / 2; }; // Add actions to the hammer animation int animNum = 0; foreach (Animation a in ((MrHammer)actor).smashAnimation) { switch (animNum) { case 0: a.addFrameAct(163, smash); break; case 1: a.addFrameAct(85, smash); break; case 2: a.addFrameAct(124, smash); break; case 3: a.addFrameAct(46, smash); break; } a.addBeginAct(beginSmash); animNum++; } // Add actions to the casting animation foreach (Animation a in ((MrHammer)actor).castCircleAnimation) { a.addBeginAct(castStunWarning); a.addEndAct(castCircle); } }