public void DefaultScriptStartTestForCurrent() { var PlayerA = new Entity("PlayerA"); Scripts.Create(PlayerA); var PlayerB = new Entity("PlayerB"); Scripts.Create(PlayerB); var InteractionEntity = new TestEntity(PlayerA, PlayerB); var Interaction = InteractionEntity.Get <Interaction>(); var InteractionsForPlayerA = Interaction.GetInteractions().GetFor(PlayerA); var InteractionsForPlayerB = Interaction.GetInteractions().GetFor(PlayerB); InteractionFn Fn; var HasInteraction = InteractionsForPlayerA.TryGetValue(TestVerb, out Fn); Assert.IsTrue(HasInteraction); Fn(new InteractionContext(PlayerA, null, null, TestVerb)); Assert.IsTrue(PlayerA.Get <Scripts>().HasScript(Interactions.DEFAULTSCRIPTNAME)); HasInteraction = InteractionsForPlayerB.TryGetValue(TestVerb, out Fn); Assert.IsTrue(HasInteraction); Fn(new InteractionContext(PlayerB, null, null, TestVerb)); Assert.IsTrue(PlayerB.Get <Scripts>().HasScript(Interactions.DEFAULTSCRIPTNAME)); }
public RFIDAntennaCabinet() { Sprite .Create(this) .SetImage(content.rooms.basement.rfidantennacabinet, 5); HotspotSprite .Create(this) .SetCaption(Basement_Res.cardboard) .SetPixelPerfect(true); Transform .Create(this) .SetPosition(688, 49) .SetZ(1); Interaction .Create(this) .SetPosition(696, 248) .SetDirection(Directions8.Up) .SetGetInteractionsFn(GetInteractions); Scripts .Create(this); Enabled = false; }
public Ryan() { Transform .Create(this) .SetPosition(290, 170) .SetAbsolute(true); Text .Create(this) .SetColor(Color.White) .SetFont(content.fonts.pixeloperator_outline_BMF) .SetWidth(300); Sprite .Create(this) .SetImage(content.rooms.office.ryan, 20, 1, 19) .SetFrame(FRAMENEUTRAL); SpriteTransformAnimation .Create(this) .SetSetFrameFn(SetFrame); SpriteData .Create(this) .SetOffset(-29, 50); Scripts .Create(this); State = RyanState.Neutral; DrawOrder = PRIORITY; }
public RFIDAntennaFloor() { CameraLocked .Create(this) .SetEnabled(false); Transform .Create(this) .SetPosition(400, 290) .SetUpdateZWithPosition(false) .SetZ(-1); SpriteData .Create(this) .SetOffset(-13, -6); Scripts .Create(this); TracerLine .Create(this) .SetCollider(WoodenPanel.Collider) .SetColor(Color.Red) .SetHitColor(Color.LightGreen) .SetVisible(false); Sprite .Create(this) .SetImage(content.rooms.basement.rfidantenna); Enabled = false; Visible = false; }
public Ego() { CameraLocked .Create(this); Transform .Create(this) .SetPosition(350, 250) .SetSpeed(150f / 0.375f) .SetOrientation(-Vector2.UnitX) .SetUpdateZWithPosition(true) .SetCalculateEffectiveSpeedFn(CalculateSpeed) .SetScale(0.24f); SpineSprite .Create(this) .SetImage("characters/ego/ego") .SetAnimationMixFn(SetAnimationMix) .SetOnSpineEvent(SpineEvent) .SetOnSpineAnimationEnd(SpineAnimationEnd); SpriteData .Create(this) .SetOrientationFlip(true); Scripts .Create(this); Lightning .Create(this) .SetLightColor(new Vector3(1.5f, 0.25f, 0.25f)); Visible = true; Enabled = true; }
public ShadowEgo() { Transform .Create(this) .SetPosition(250, 250) .SetSpeed(150f / 0.375f) .SetOrientation(-Vector2.UnitX) .SetUpdateZWithPosition(true) .SetCalculateEffectiveSpeedFn(CalculateSpeed) .SetScale(0.5f); Sprite .Create(this) .SetEnableNormalMap(true) .SetImage("characters/ego/sprite", 9, 4); SpriteTransformAnimation .Create(this) .SetSetFrameFn(SetFrame); SpriteData .Create(this) .SetOrientationFlip(false) .SetOffset(-40, -310); Scripts .Create(this); Lightning .Create(this) .SetLightColor(new Vector3(1.5f, 0.25f, 0.25f)); Visible = true; Enabled = true; }
public Therapist() { Transform .Create(this) .SetPosition(440, 200) .SetZ(2) .SetAbsolute(true); Text .Create(this) .SetColor(Color.OrangeRed) .SetFont(content.fonts.pixeloperator_outline_BMF) .SetWidth(300); Sprite .Create(this) .SetImage(content.rooms.office.therapist, 5, 1); SpriteTransformAnimation .Create(this) .SetSetFrameFn(SetFrame); SpriteData .Create(this) .SetOffset(-87, 45); Scripts .Create(this); }
public Player() { Transform .Create(this); Scripts .Create(this); }
public RyanVoice() { Transform .Create(this) .SetPosition(Game.VIRTUAL_WIDTH * 3 / 4 - 120, 150) .SetAbsolute(true); Text .Create(this) .SetColor(Color.White) .SetFont(content.fonts.pixeloperator_outline_BMF) .SetWidth(600); Scripts .Create(this); }
public Drone() { Sprite .Create(this) .SetGetPositionFn(GetSpritePosition) .SetImage(content.rooms.basement.drone, 5, 4); SpriteTransformAnimation .Create(this) .SetSetFrameFn(SetFrame); CameraLocked .Create(this) .SetEnabled(false); Transform .Create(this) .SetPosition(INITIAL_POSITION) .SetDirection(Directions4.Down) .SetUpdateZWithPosition(false) .SetZ(INITIAL_Z); SpriteData .Create(this) .SetOffset(-42, -16); HotspotSprite .Create(this) .SetCaption(Basement_Res.drone) .SetPixelPerfect(false); Interaction .Create(this) .SetDirection(Directions8.Down) .SetGetInteractionsFn(GetInteractions); Scripts .Create(this); DroneDisplacement .Create(this); Flying = false; Enabled = false; Visible = false; }
public Mouse() { Transform .Create(this) .SetPosition(STARTPOSITION) .SetSpeed(120) .SetOrientation(-Vector2.UnitX) .SetUpdateZWithPosition(true) .SetScale(1.0f); Sprite .Create(this) .SetEnableNormalMap(false) .SetImage(content.characters.mouse.sprite, 9, 7); SpriteTransformAnimation .Create(this) .SetSetFrameFn(SetFrame); SpriteCustomAnimation .Create(this) .SetGetFramesAction(GetCustomAnimationFrames); SpriteData .Create(this) .SetOrientationFlip(false) .SetOffset(-7, -13); Navigation .Create(this) .SetApplyScale(false) .SetApplyColoring(false) .SetRestrictPosition(true) .SetScale(1.0f); Scripts .Create(this); CameraLocked .Create(this) .SetEnabled(false); Visible = false; Enabled = false; }
Entity CreateEntity() { var Entity = new Entity(); Scripts.Create(Entity); Transform.Create(Entity); var TextComponent = Text.Create(Entity); TextComponent.MeasureStringFn = MeasureString; var Scene = new Scene("s1"); Scene.Push(Entity); var World = new World(WorldTest.ServiceProvider); World.Push(Scene); return(Entity); }
public ScreenText() { Text .Create(this) .SetColor(Color.White) .SetAlign(Alignment.Center) .SetFont(content.fonts.pixeloperator_outline_BMF) .SetFadeDuration(3f) .SetHeight(Game.VIRTUAL_HEIGHT) .SetWidth(Game.VIRTUAL_WIDTH - 50); Transform .Create(this) .SetPosition(Game.VIRTUAL_WIDTH / 2, Game.VIRTUAL_HEIGHT / 2); Scripts .Create(this); DrawOrder = 2; }
public RyanLying() { Sprite .Create(this) .SetImage(content.rooms.basement.ryanlying, 8); Transform .Create(this) .SetPosition(259, 178) .SetScale(1.25f) .SetZ(263); Scripts .Create(this); SpriteTransformAnimation .Create(this) .SetSetFrameFn(SetFrame); State = RyanLyingState.EyesClosed; }
public void HighWalkSpeedLoop() { var Entity = new Entity(); Transform.Create(Entity).SetSpeed(800); Scripts.Create(Entity); Navigation.Create(Entity).SetPath(CreateRectangularPath(100)); Entity.Get <Scripts>().GoTo(50, 50); var LastPosition = new Vector2(); var i = 0; do { LastPosition = Entity.Get <Transform>().Position; Entity.Update(); if (++i > 10) { throw new Exception("Walking for too many updates"); } } while (LastPosition != Entity.Get <Transform>().Position); }
public RyanBlooddrop(Vector2 position, byte frame, int ttl, string id, float z) : base(id) { Sprite .Create(this) .SetTexture(Game.Ego.Get <BloodDropEmitter>().Texture, 16, 1) .SetFrame(16); SpriteData .Create(this) .SetColor(Color.White); HotspotSprite .Create(this) .SetPixelPerfect(true) .SetCaption(Basement_Res.drop_of_blood); Transform .Create(this) .SetZ(z) .SetPosition(position - new Vector2(0, 55)); Interaction .Create(this) .SetPosition(position - new Vector2(0, 55)) .SetGetInteractionsFn(GetInteractions); Scripts .Create(this); TimeToLive = Math.Min(500, ttl); UpdateCount = 0; TargetFrame = frame; TargetPosition = position; Visible = true; }
public Ryan(Inventory inventory) { Inventory = inventory; CameraLocked .Create(this); Transform .Create(this) .SetPosition(350, 250) .SetSpeed(120) .SetOrientation(-Vector2.UnitY) .SetUpdateZWithPosition(true) .SetScale(1.0f); Sprite .Create(this) .SetEnableNormalMap(false) .SetImage(content.characters.ryan.sprite_blood, 13, 8, 0); SpriteTransformAnimation .Create(this) .SetSetFrameFn(SetFrame); SpriteCustomAnimation .Create(this) .SetGetFramesAction(GetCustomAnimationFrames); SpriteData .Create(this) .SetOrientationFlip(false) .SetOffset(-76, -143); Text .Create(this) .SetFont(content.fonts.pixeloperator_outline_BMF) .SetWidth(300) .SetConstrain(true) .SetConstrainingRectangle(new Rectangle(0, 0, Game.VIRTUAL_WIDTH, Game.VIRTUAL_HEIGHT)) .SetAlign(Alignment.Bottom); Navigation .Create(this) .SetApplyScale(true) .SetApplyColoring(true) .SetRestrictPosition(true) .SetScale(1.75f); Scripts .Create(this); Lightning .Create(this) .SetLightPosition(new Vector3(new Vector2(51, 61), 0)) .SetLightColor(new Vector3(1.25f, 0.6f, 0.6f)); BloodDropEmitter .Create(this); Score .Create(this); RandomCountdown .Create(this) .SetDuration(7) .SetMinUpdates(300) .SetMaxUpdates(500); }
public Director() { Scripts .Create(this); }