public HUDQuad(RenderSet render_set, Vector3d p, Vector3d s) : this(render_set, p, p + new Vector3d(s.X, 0.0, 0.0), p + new Vector3d(s.X, s.Y, 0.0), p + new Vector3d(0.0, s.Y, 0.0)) { }
protected PressureSwitch(RenderSet render_set, double x, double y, ActionEventHandler state_changed, SharedState <SwitchState> state, SharedState <double> latch_expiration, Stopwatch latch_timer, double latch_time, Texture texture) : base(render_set, x, y, texture) { TurnOn = new SpriteAnimation(Texture, 50, new int [] { 0, 1, 2, 3 }); TurnOff = new SpriteAnimation(Texture, 50, new int [] { 3, 2, 1, 0 }); _LatchTimer = latch_timer; _LatchTime = latch_time; _LatchExpiration = latch_expiration; _State = state; _State.SharedStateChanged += (sender, e) => { switch (e.CurrentState) { case SwitchState.Open: PlayAnimation(TurnOff); break; case SwitchState.Closed: PlayAnimation(TurnOn); break; } state_changed(sender, new ActionEventArgs(e.CurrentState, this)); }; }
// Main constructor: public BooleanIndicator(RenderSet render_set, double x, double y) : base(render_set, x, y, 1.0, 1.0, null, Texture.Get("sprite_indicator")) { State = false; _Color = new Color4(Color.SkyBlue); _NextLayer = new LayeredSprite(render_set, x, y, 1.0, 1.0, null, Texture.Get("sprite_indicator_gloss")); }
protected PressureSwitch(RenderSet render_set, double x, double y, ActionEventHandler state_changed, SharedState <SwitchState> state, SharedState <double> latch_expiration, Stopwatch latch_timer, double latch_time) : this(render_set, x, y, state_changed, state, latch_expiration, latch_timer, latch_time, Texture.Get("sprite_floor_switch")) { }
public TileMap(RenderSet render_set, int countx, int county, Texture texture) : base(render_set) { _CountX = countx; _CountY = county; Texture = texture; IndexMap = new int[_CountX, _CountY]; }
public Drawable(RenderSet render_set) { _RenderSet = render_set; if (_RenderSet != null) { _RenderSet.Add(this); } RenderSetTransfer += HandlerenderSetTransfer; }
public BlueprintLine(Vector3d a, Vector3d b, RenderSet render_set, int millis) { _RenderSet = render_set; _RenderSet.Add(this); Lifespan = millis; A = a; B = b; Timer.Start(); }
public HUDQuad(RenderSet render_set, Vector3d a, Vector3d b, Vector3d c, Vector3d d) { A = a; B = b; C = c; D = d; _RenderSet = render_set; _RenderSet.Add(this); }
protected ProjectileSwitch(RenderSet render_set, double x, double y, ActionEventHandler state_changed, SharedState <SwitchState> state, SharedState <double> latch_expiration, Stopwatch latch_timer, double latch_time) : base(render_set, x, y, state_changed, state, latch_expiration, latch_timer, latch_time, Texture.Get("sprite_projectile_switch")) { Theta = 0.0; }
public RaindropRippleEffect(RenderSet render_set, double x, double y) : base(render_set, x, y, Texture.Get("sprite_ripples")) { //PlayAnimation(_AnimationDefault = new SpriteAnimation(Texture, 100, true, false, "f0", "f1")); Lifespan = 2.0; _Color = new Color4(255, 24, 127, 255); _Color2 = new Color4(0.0f, (float)ColorRandy.NextDouble() * 0.5f + 0.5f, (float)ColorRandy.NextDouble() * 0.5f + 0.5f, 0.0f); Timer.Restart(); }
public Line(Vector3d start, Vector3d end, float thickness, RenderSet render_set) : base(render_set) { _Position = start; _Direction = end; Color = Color.Black; Thickness = thickness; InitPhysics(); }
protected Gateway(RenderSet render_set, double x, double y, SharedState <bool> sync_state, Texture texture) : base(render_set, x, y, texture) { _State = sync_state; _State.SharedStateChanged += (sender, e) => { PlayAnimation(e.CurrentState ? Open : Close); Body.Enabled = (_RenderSet.Scene == _RenderSet.Scene.Game.CurrentScene) && !e.CurrentState; }; }
public Spidey(RenderSet render_set, double x, double y) : base(render_set, x, y, Texture.Get("sprite_spidey_0")) { if (Body != null) { Body.OnCollision += HandleOnCollision; Body.BodyType = BodyType.Dynamic; } JumpTimer.Start(); }
protected StuffOne(RenderSet render_set, double x, double y, double z, int wide, int high, Texture texture) : base(render_set) { _Wide = wide; _High = high; _Position.X = x; _Position.Y = y; _Position.Z = z; _Texture = texture; StuffTimer.Start(); }
public FoodItem(RenderSet render_set, double x, double y, int variant = 0) : base(render_set, x, y, Texture.Get("sprite_food_single")) { Variant = variant % Texture.Regions.Length; PlayAnimation(_AnimationDefault = new SpriteAnimation(Texture, true, false, Variant)); if (Body != null) { Body.OnCollision += HandleOnCollision; Body.BodyType = BodyType.Static; } }
public SpriteObject(RenderSet render_set, Texture texture) : base(render_set, texture) { _RenderSet = render_set; InitPhysics(); // HACK: Positioning the body must occur after world // has been solved at least one time in order to avoid // fixtures being shifted rather than the bodies. _RenderSet.Scene.Game.WorldMain.Step(0.0f); RenderSetEntry += EnteredRenderSet; // Virtual default event handler }
public Dialog(RenderSet render_set, string title, List <DialogStanza> stanzas) : base(null) { _Title = title; Stanzas = stanzas; _RenderSet = render_set; _Shown = false; ScaleX = _RenderSet.Scene.ViewSize.X; ScaleY = (int)(_RenderSet.Scene.ViewSize.Y * 0.25); FadeUp = Texture.Get("sprite_dialog_fade_up"); SpeakerWriter = new PTextWriter(_RenderSet.Scene.Game, new Size((int)ScaleX, 24)); SpeechWriter = new PTextWriter(_RenderSet.Scene.Game, new Size((int)ScaleX, (int)ScaleY)); }
public PolarBear(RenderSet render_set, double x, double y) : base(render_set, x, y, Texture.Get("sprite_polarbear")) { Texture texture = Texture.Get("sprite_polarbear"); AnimationWalk = new SpriteAnimation(texture, 100, true, false, "stand", "walk1", "walk2", "walk3", "walk4", "walk5", "walk6", "walk7"); AnimationSwipe = new SpriteAnimation(texture, 100, true, false, "swipe1", "swipe2", "swipe3", "swipe4"); PlayAnimation(AnimationWalk); if (Body != null) { Body.OnCollision += HandleOnCollision; Body.BodyType = BodyType.Dynamic; } JumpTimer.Start(); AttackTimer.Start(); }
protected ExtenderPlatform(RenderSet render_set, double x, double y, SharedState <bool> sync_state) : base(render_set, x, y, Texture.Get("sprite_extender_platform")) { Extend = new SpriteAnimation(Texture, 50, false, false, new[] { "collapsed", "t1", "t2", "extended" }); Collapse = new SpriteAnimation(Texture, 50, false, false, new[] { "extended", "t2", "t1", "collapsed" }); _State = sync_state; RenderSetEntry += (sender, e) => { PlayAnimation(_AnimationDefault = new SpriteAnimation(false, false, _State ? Collapse.Frames[0] : Extend.Frames[0])); }; _State.SharedStateChanged += (sender, e) => { PlayAnimation(e.CurrentState ? Extend : Collapse); Body.Enabled = (Set.Scene == Set.Scene.Game.CurrentScene) && e.CurrentState; }; if (Body != null) { Body.OnCollision += HandleOnCollision; } }
public virtual void Dispose() { _RenderSet = null; if (_Blueprints != null) { for (int i = 0; i < _Blueprints.Count; i++) { if (_Blueprints[i].Set != null) { _Blueprints[i].Set.Remove(_Blueprints[i]); } _Blueprints[i].Dispose(); _Blueprints[i] = null; } _Blueprints.Clear(); _Blueprints = null; } RenderSetEntry = null; RenderSetTransfer = null; }
public SpriteBase(RenderSet render_set, double x, double y, double scalex, double scaley, Texture texture) : base(render_set) { // Size will scale _Texture width and height _Color = Color.White; _Scale.X = scalex; _Scale.Y = scaley; _TileX = 1.0; _TileY = 1.0; _AnimationFrameIndex = 0; _FrameTimer = new Stopwatch(); _AnimationDefault = _AnimationCurrent = new SpriteAnimation(texture, 0); //_FrameStatic = _AnimationDefault.Frames[0]; // Position for world objects is handled differently if (!(this is IWorldObject)) { Corner = new Vector3d(x, y, 0.0); } }
protected Scene(PositronGame game, string name) { _Game = game; _Name = name; // TODO: This is awful. Fix it. // TODO: Actually fix this. // TODO: Seriously, make this -not suck- ViewWidth = _Game.Window.CanvasWidth; ViewHeight = _Game.Window.CanvasHeight; Background = new RenderSet(this); Rear = new RenderSet(this); Stage = new RenderSet(this); Tests = new RenderSet(this); Front = new RenderSet(this); WorldBlueprint = new RenderSet(this); HUD = new RenderSet(this); HUDBlueprint = new RenderSet(this); HUDDebug = new RenderSet(this); // This should contain everything AllRenderSetsInOrder would contain // This is an optimization over using an enumerable //All = new RenderSet(this, Background, Rear, Stage, Tests, Front, HUD, HUDBlueprint, HUDDebug); SceneEntry += (sender, e) => { foreach (RenderSet render_set in AllRenderSetsInOrder()) { render_set.ForEach(element => { if (element is IWorldObject) { IWorldObject w_o = (IWorldObject)element; //Console.WriteLine("Rotation for {0} sprite with rotation {1}", w_o, w_o.Theta); } }); } }; }
// Main constructor: public Player(RenderSet render_set, double x, double y, Texture texture) : base(render_set, x, y, texture) { HealthChanged += (object sender, HealthChangedEventArgs e) => { _Health = Math.Max(0, e.HealthNow); }; OnHealthChanged(this, _HealthMax); AnimationStand = new SpriteAnimation(texture, "stand"); AnimationWalk = new SpriteAnimation(texture, 100, true, false, "stand", "walk1", "walk2", "walk3", "walk4", "walk5", "walk6"); AnimationStationaryFw = new SpriteAnimation(texture, "stand"); // new SpriteAnimation(texture, "protag standing facing front"); AnimationWalkFw = new SpriteAnimation(texture, "stand"); // new SpriteAnimation(texture, true, "protag walking front 1", "protag walking front 2", "protag walking front 3", "protag walking front 4"); AnimationStationaryBk = new SpriteAnimation(texture, "stand"); // new SpriteAnimation(texture, "protag standing back" ); AnimationWalkBk = new SpriteAnimation(texture, "stand"); // new SpriteAnimation(texture, true, "protag walking back 1", "protag walking back 2", "protag walking back 3", "protag walking back 4"); AnimationCrouch = new SpriteAnimation(texture, "stand"); // new SpriteAnimation(texture, true, "protag crouch"); AnimationCrawl = new SpriteAnimation(texture, "stand"); // new SpriteAnimation(texture, 150, true, "protag crouch walk 1", "protag crouch walk 2", "protag crouch walk 3", "protag crouch walk 4"); AnimationPreJump = new SpriteAnimation(texture, true, "jump"); AnimationJumping = new SpriteAnimation(texture, true, "jump"); AnimationEndJump = new SpriteAnimation(texture, "stand"); // new SpriteAnimation(texture, "protag jumping 4"); AnimationEndJump.Sound = Sound.Get("sfx_player_land_two_feet"); AnimationSlingshot = new SpriteAnimation(texture, 50, true, false, "shoot1", "shoot2", "shoot3", "shoot4"); AnimationAimGunFwd = new SpriteAnimation(texture, "stand"); // new SpriteAnimation(texture, true, "protag aiming gun"); AnimationAimGunFwdUp = new SpriteAnimation(texture, "stand"); // new SpriteAnimation(texture, true, "protag aiming gun up"); AnimationAimGunFwdDown = new SpriteAnimation(texture, "stand"); // new SpriteAnimation(texture, true, "protag aiming gun down"); AnimationAimGunFwdCrouch = new SpriteAnimation(texture, "stand"); // new SpriteAnimation(texture, true, "protag aiming gun crouch"); AnimationAimGunFwdJump = new SpriteAnimation(texture, "stand"); // new SpriteAnimation(texture, true, "protag aiming gun jump"); AnimationTakeHit = new SpriteAnimation(texture, "hit1", "hit2"); AnimationPreJump.Frames[0].FrameTime = 100; //AnimationPreJump.Frames[1].FrameTime = 50; AnimationEndJump.Frames[0].FrameTime = 200; _FrameTimer.Start(); JumpTimer.Start(); }
public Door(RenderSet render_set, Door destination) : this(render_set, destination.PositionX, destination.PositionY, destination) { }
protected Gateway(RenderSet render_set, double x, double y, SharedState <bool> sync_state) : this(render_set, x, y, sync_state, Texture.Get("sprite_gateway")) { Open = new SpriteAnimation(Texture, 50, new int [] { 0, 1, 2, 3 }); Close = new SpriteAnimation(Texture, 50, new int [] { 3, 2, 1, 0 }); }
public Gateway(RenderSet render_set, double x, double y, Gateway sync_gateway) : this(render_set, x, y, sync_gateway._State) { }
public Gateway(RenderSet render_set, double x, double y, bool initial_state = false) : this(render_set, x, y, new SharedState <bool>(initial_state)) { }
public SideWalkTile(RenderSet render_set, double x, double y) : base(render_set, x, y, Texture.Get("sprite_sidewalk")) { _Variant = Variance.Next(Texture.Regions.Length); PlayAnimation(new SpriteAnimation(Texture, _Variant)); }
public Door(RenderSet render_set, double x, double y) : base(render_set, x, y, Texture.Get("sprite_doorway")) { }
public Door(RenderSet render_set, double x, double y, Scene next_scene) : this(render_set, x, y) { _NextScene = next_scene; }