public override void CollidedTop(Thing thing) { if (thing != null && !thing.CanPush) { thing.Velocity.Y = -4; } animation = 9; }
public override void CollidedBottom(Thing thing) { base.CollidedBottom(thing); if (type == Map.SPIKE_DOWN) { thing.Damaged(this); } }
public override void CollidedTop(Thing thing) { if (!pressed) { Game.ToggleDoors(); pressed = true; pressSound = true; } }
public void Play(SecondaryBuffer buffer, Thing thing) { // �V�����X�P�Anull���ǂ����`�F�b�N���Ȃ���Ȃ��Ƃ͉����� if (device == null) return; if (numChannels == MAX_NUM_CHANNELS) return; channels[numChannels] = new GameSoundChannel(buffer.Clone(device), thing); channels[numChannels].Buffer.Pan = CalcPan(thing); channels[numChannels].Buffer.Volume = CalcVolume(thing); channels[numChannels].Buffer.Play(0, BufferPlayFlags.Default); numChannels++; }
private static bool isRemoved(Thing thing) { return thing.Removed; }
public bool IsObstacle(Thing thing, int row, int col) { if (thing is Lift) { return this[row, col] != NONE; } else if (thing is Door) { return this[row, col] != NONE && this[row, col] != DOOR_SLIDE; } return this[row, col] != NONE && this[row, col] != LIFT_RETURN; }
private int CalcVolume(Thing thing) { if (thing == null) { return (int)Volume.Max; } Vector v = thing.CenterOnScreen; if (0 < v.X && v.X < Mafia.SCREEN_WIDTH && 0 < v.Y && v.Y < Mafia.SCREEN_HEIGHT) { return 0; } double range1 = -v.X; double range2 = v.X - Mafia.SCREEN_WIDTH; double range3 = -v.Y; double range4 = v.Y - Mafia.SCREEN_HEIGHT; double range = Math.Max(Math.Max(range1, range2), Math.Max(range3, range4)); int volume = (int)Math.Round(-range * 10000 / Mafia.SOUND_RANGE); if (volume < -10000) volume = -10000; if (volume > 0) volume = 0; return volume; }
public override void CollidedRight(Thing thing) { base.CollidedRight(thing); if (type == Map.SPIKE_RIGHT) { thing.Damaged(this); } }
public virtual void CollidedTop(Thing thing) { if (!thing.CanPush && !Carry.Has(thing)) { Carry.AddThing(thing); } }
public virtual void CollidedRight(Thing thing) { }
public virtual void CollidedLeft(Thing thing) { }
public virtual void CollidedBottom(Thing thing) { }
public virtual void CollidBottom(Thing thing) { Velocity.Y = 0; }
public bool Has(Thing thing) { return list.IndexOf(thing) != -1; }
public void AddThing(Thing thing) { list.Add(thing); }
public override void CollidedTop(Thing thing) { base.CollidedTop(thing); if (type != Map.SPIKE_DOWN) { if (!falling) { falling = true; fallSound = true; } } }
public override void Damaged(Thing thing) { if (damaged) return; damaged = true; for (int i = 0; i < 8; i++) { Game.AddThingInGame(new Tiun(Game, Position, i, 2, 16, Tiun.MOKU)); } Remove(); }
public virtual void CollidRight(Thing thing) { Velocity.X = 0; }
public override void CollidedLeft(Thing thing) { base.CollidedLeft(thing); if (type == Map.SPIKE_LEFT) { thing.Damaged(this); } }
public virtual void CollidTop(Thing thing) { Velocity.Y = 0; }
public void AddThingInGame(Thing thing) { addThings.AddThing(thing); }
public virtual void Damaged(Thing thing) { }
private int CalcPan(Thing thing) { if (thing == null) { return (int)Pan.Center; } double pan = (thing.CenterOnScreen.X - Mafia.SCREEN_WIDTH / 2) * 10000 / (Mafia.SCREEN_WIDTH * 4); if (Math.Abs(pan) > 10000) { pan = Math.Sign(pan) * 10000; } return (int)Math.Round(pan); }
protected bool IsNotCarry(Thing thing) { return !(thing.Bottom == Top && thing.Left < Right && Left < thing.Right && thing.IsObstacle); }
protected bool Overlapped(Thing thing) { return Left < thing.Right && thing.Left < Right && Top < thing.Bottom && thing.Top < Bottom; }
protected bool Overlapped(Thing thing, int depth) { return Left + depth < thing.Right && thing.Left + depth < Right && Top + depth < thing.Bottom && thing.Top + depth < Bottom; }
public GameSoundChannel(SecondaryBuffer buffer, Thing thing) { Buffer = buffer; Thing = thing; }
public override void CollidBottom(Thing thing) { base.CollidBottom(thing); LandState = ON_GROUND; }
public override void CollidLeft(Thing thing) { }
public override void Damaged(Thing thing) { Animation = 0; if (!missed) { missed = true; for (int i = 0; i < 8; i++) { Game.AddThingInGame(new Tiun(Game, Position, i, 2, 64, Tiun.TIUN)); Game.AddThingInGame(new Tiun(Game, Position, i, 4, 64, Tiun.TIUN)); } tiunSound = true; } }