Exemple #1
0
        public Entity Build()
        {
            int width  = 4;
            int height = 3;

            float detectorYOffset = 0.5f;

            float detectorOverhang = 1f;
            float detectorHeight   = 1f;

            float detectorWidth = width + detectorOverhang * 2;

            var characterDetector = new Touching();

            return(EntityBuilder.New()
                   .WithTag(Tags.PLATFORM)
                   .WithTexture(TextureUtil.CreateTexture((int)(width * Transform.PIXELS_A_METRE),
                                                          (int)(height * Transform.PIXELS_A_METRE), Color.Black))
                   .With(ColliderBuilder.New().BoxShape(width, height).Create())
                   .With(new Divable()
            {
                Touching = characterDetector
            })
                   .WithChild(EntityBuilder.New()
                              .With(characterDetector)
                              .AtPosition(new Vector2(0, -height * 0.5f - detectorYOffset - detectorHeight * 0.5f))
                              //.WithTexture(TextureUtil.CreateTexture((int) (detectorWidth*Transform.PIXELS_A_METRE),
                              //    (int) (detectorHeight*Transform.PIXELS_A_METRE), Color.Red))
                              .With(ColliderBuilder.New().BoxShape(detectorWidth, detectorHeight).IsTrigger().Create())
                              )
                   .Create());
        }
Exemple #2
0
        private void Set_box_position(Touching direction = Touching.DOWN)
        {
            float height = 44;


            if (direction == Touching.DOWN)
            {
                pos.Y   = 180 - height - 2;
                height -= 2;
            }
            else if (direction == Touching.UP)
            {
                pos.Y = 22;
            }

            pos.X = 2;

            Writer = new TextWriter
            {
                WriteArea = MathUtilities.CreateRectangle(pos.X + 4, pos.Y + 5, Width - 16, height - 8)
            };


            //if (DH.isZH()) dialogue.y = dialogue_box.y + 2;

            _blinkyPos = new Vector2(pos.X + Width - 10, pos.Y + Height - 10);
        }
Exemple #3
0
        private void Set_box_position(Touching direction = Touching.DOWN)
        {
            int height = 44;


            if (direction == Touching.DOWN)
            {
                pos.Y   = GameConstants.SCREEN_HEIGHT_IN_PIXELS - height - 2;
                height -= 2;
            }
            else if (direction == Touching.UP)
            {
                pos.Y = 2;
            }

            pos.Y += GameConstants.HEADER_HEIGHT;

            pos.X = 2;

            Writer = new TextWriter((int)pos.X + 4, (int)pos.Y + 5, Width - 16, height - 8);


            //if (DH.isZH()) dialogue.y = dialogue_box.y + 2;

            _blinkyPos = new Vector2(pos.X + Width - 10, pos.Y + Height - 10);


            introPrompt = new UILabel(new Vector2(pos.X + Width - 4, pos.Y + Height - 14), false, "", new Color(254, 33, 33), DrawOrder.TEXT);

            UpdatePrompt();
        }
Exemple #4
0
 public Tile(int tileWidth, int tileHeight, bool visible, Touching collisionDirections)
     : base(tileWidth, tileHeight)
 {
     allowCollisions = collisionDirections;
     immovable       = true;
     this.visible    = visible;
 }
Exemple #5
0
        public ProximitySensor(Touching dir, Red_Boss parent) : base(Vector2.Zero, Drawing.DrawOrder.ENTITIES)
        {
            visible     = false;
            this.parent = parent;
            direction   = dir;
            switch (dir)
            {
            case Touching.UP:
                width              = parent.width;
                height             = 8;
                offset_from_parent = new(0, -21);
                break;

            case Touching.DOWN:
                width              = parent.width + 4;
                height             = 12;
                offset_from_parent = new(0, parent.height + 8);
                break;

            case Touching.LEFT:
                width              = 12;
                height             = parent.height + 20;
                offset_from_parent = new(-18, -10);
                break;

            case Touching.RIGHT:
                width              = 8;
                height             = parent.height + 16;
                offset_from_parent = new(parent.width + 7, -8);
                break;
            }
        }
Exemple #6
0
        public void Spawn(Touching dir, Red_Boss parent)
        {
            if (dir.HasFlag(Touching.UP))
            {
                Position = parent.Position + new Vector2(16 * t_index - 14, -13);
            }
            else if (dir.HasFlag(Touching.LEFT))
            {
                Position = parent.Position + new Vector2(-14, 16 * t_index - 16);
            }
            else if (dir.HasFlag(Touching.RIGHT))
            {
                Position = parent.Position + new Vector2(parent.width + 2, 16 * t_index - 16);
            }
            else if (dir.HasFlag(Touching.DOWN))
            {
                Position = parent.Position + new Vector2(16 * t_index - 14, parent.height + 2);
            }
            else
            {
                //player isn't close in any direction, so random locations
                Vector2 ul = MapUtilities.GetRoomUpperLeftPos(GlobalState.CurrentMapGrid);
                Position.X = ul.X + 16 + 12 * (1 + t_index) + GlobalState.RNG.Next(-5, 6);
                Position.Y = ul.Y + 16 * GlobalState.RNG.Next(1, 4) + GlobalState.RNG.Next(-5, 6) + tentacle.height - height;
            }

            tentacle.Position = Position + Vector2.UnitY * (height - 3 - tentacle.height);
            tentacle.y_push   = tentacle.height;

            Flicker(0.7f + (float)GlobalState.RNG.NextDouble());
            state = StateLogic();
        }
Exemple #7
0
        private void SetupSurface(InkCanvas renderer, ref Surface surface, ref Surface surfaceTouching, ref Surface surfaceRendering, ref Surface surfaceSimulating)
        {
            surface = new Surface(renderer);
            ProxyFactory factory = new ProxyFactory();

            Tracking_Surface interceptorTracking_Surface = new Tracking_Surface(surface);
            var surfaceProxyTemp = factory.CreateProxy <Surface>(interceptorTracking_Surface);

            surfaceProxyTemp.init();

            Rendering interceptorRendering = new Rendering(surface);

            surfaceRendering = factory.CreateProxy <Surface>(interceptorRendering);
            surfaceRendering.initRender();
            surfaceRendering.afterSetTrack();
            surface["self"] = surfaceRendering;

            Touching interceptorTouching = new Touching(surface);

            surfaceTouching = factory.CreateProxy <Surface>(interceptorTouching);

            Simulating interceptorSimulating = new Simulating(surface);

            surfaceSimulating = factory.CreateProxy <Surface>(interceptorSimulating);
        }
        public void DoCollision(Map map, bool ignore_player_map_collision)
        {
            foreach (Entity e in _mapColliders.Where(e => e.exists))
            {
                Touching t = e.allowCollisions;
                if (ignore_player_map_collision && e is Player)
                {
                    e.Solid = false; //during transition no collision with map, but do have tile effects take an effect
                }
                map.Collide(e);
                foreach (Entity m in _mapEntities.Where(m => m.Solid && m.exists && m.Hitbox.Intersects(e.Hitbox)))
                {
                    m.Collided(e);
                }
                e.allowCollisions = t;
            }
            //map-entity collision sets per-frame state values that are checked in entity-entity collisions(player+dust->raft)
            foreach (Group g in _groups.Values)
            {
                foreach (Entity collider in g.colliders.Where(e => e.exists))
                {
                    foreach (Entity target in g.targets.Where(e => e.exists && !ReferenceEquals(e, collider)))
                    {
                        if (collider.Hitbox.Intersects(target.Hitbox))
                        {
                            collider.Collided(target);
                        }
                    }
                }
            }

            Vector2 roomUpLeft      = MapUtilities.GetRoomUpperLeftPos(GlobalState.CurrentMapGrid);
            Vector2 roomBottomRight = roomUpLeft + Vector2.One * GameConstants.SCREEN_WIDTH_IN_PIXELS;

            foreach (Entity e in _keepOnScreen.Where(e => e.exists))
            {
                if (e.Hitbox.Left < roomUpLeft.X)
                {
                    e.Position.X = roomUpLeft.X;
                    e.touching  |= Touching.LEFT;
                }
                else if (e.Hitbox.Right > roomBottomRight.X)
                {
                    e.Position.X = roomBottomRight.X - e.width;
                    e.touching  |= Touching.RIGHT;
                }

                if (e.Hitbox.Top < roomUpLeft.Y)
                {
                    e.Position.Y = roomUpLeft.Y;
                    e.touching  |= Touching.UP;
                }
                else if (e.Hitbox.Bottom > roomBottomRight.Y)
                {
                    e.Position.Y = roomBottomRight.Y - e.height;
                    e.touching  |= Touching.DOWN;
                }
            }
        }
 public CollissionData(int start, int end, Touching allowedCollisions, CollisionEventType collisionEventType = CollisionEventType.NONE, Touching direction = Touching.ANY)
 {
     Start              = start;
     End                = end;
     AllowedCollisions  = allowedCollisions;
     CollisionEventType = collisionEventType;
     Direction          = direction;
 }
Exemple #10
0
 public override void Conveyor(Touching direction)
 {
     if (direction != Touching.ANY && !IS_RAFT)
     {
         velocity = FacingDirection(FacingFromTouching(direction)) * 10;
     }
     ON_CONVEYOR = true;
 }
Exemple #11
0
        private static List <CollissionData> GetColData()
        {
            List <CollissionData> data = new List <CollissionData>();

            var assembly = Assembly.GetExecutingAssembly();

            string path = $"{assembly.GetName().Name}.{CollissionFilePath}.{GlobalState.CURRENT_MAP_NAME}.col";

            using (Stream stream = assembly.GetManifestResourceStream(path))
            {
                if (stream == null)
                {
                    return(new List <CollissionData>());
                }

                using (StreamReader reader = new StreamReader(stream))
                {
                    while (!reader.EndOfStream)
                    {
                        string[] dataStrings = reader.ReadLine().Split('\t');

                        int                min        = -1;
                        int                max        = -1;
                        Touching           allowedCol = Touching.ANY;
                        CollisionEventType eventType  = CollisionEventType.NONE;
                        Touching           direction  = Touching.ANY;

                        if (Enum.TryParse(dataStrings[1], out allowedCol) &&
                            (dataStrings.Length == 2 || (Enum.TryParse(dataStrings[2], out eventType) &&
                                                         (dataStrings.Length <= 3 || Enum.TryParse(dataStrings[3], out direction)))))
                        {
                            if (dataStrings[0].Contains('-'))
                            {
                                string[] minMax = dataStrings[0].Split('-');

                                if (int.TryParse(minMax[0], out min) &&
                                    int.TryParse(minMax[1], out max))
                                {
                                    data.Add(new CollissionData(min, max, allowedCol, eventType, direction));
                                }
                            }
                            else
                            {
                                if (int.TryParse(dataStrings[0], out min))
                                {
                                    data.Add(new CollissionData(min, allowedCol, eventType, direction));
                                }
                            }
                        }
                    }
                }
            }

            return(data);
        }
Exemple #12
0
 public static Facing FacingFromTouching(Touching t)
 {
     return(t switch
     {
         Touching.NONE => throw new InvalidCastException(),
         Touching.LEFT => Facing.LEFT,
         Touching.RIGHT => Facing.RIGHT,
         Touching.UP => Facing.UP,
         Touching.DOWN => Facing.DOWN,
         Touching.ANY => throw new InvalidCastException(),
         _ => throw new InvalidCastException()
     });
Exemple #13
0
        public override void Update()
        {
            base.Update();
            invincible_timer -= GameTimes.DeltaTime;
            state.MoveNext();
            proximity_hits = Touching.NONE;

            if (loopSFX)
            {
                SoundManager.PlaySoundEffect("bubble_loop"); //Call each frame to get looping behavior out of a sound effect
            }
        }
Exemple #14
0
        public override void Collided(Entity other)
        {
            if (other is Player p)
            {
                p.ReceiveDamage(1);
            }
            else if (other is Broom b)
            {
                if (_hitTimer <= 0)
                {
                    if (b.facing == Facing.DOWN)
                    {
                        _health--;
                        Flicker(hitTimerMax / 2);
                        Play("back_hit");
                        SoundManager.PlaySoundEffect("shieldy-hit");
                    }
                    else
                    {
                        Play("front_hit");
                        SoundManager.PlaySoundEffect("shieldy_ineffective");

                        Vector2 newPos = Position;

                        switch (b.facing)
                        {
                        case Facing.LEFT:
                            newPos.X -= 8;
                            break;

                        case Facing.UP:
                            newPos.Y -= 8;
                            break;

                        case Facing.RIGHT:
                            newPos.X += 8;
                            break;
                        }

                        Touching checkTL = GlobalState.Map.GetCollisionData(newPos);
                        Touching checkBR = GlobalState.Map.GetCollisionData(newPos + new Vector2(width, height));

                        if (checkTL == Touching.NONE && checkBR == Touching.NONE)
                        {
                            Position = newPos;
                        }
                    }

                    _hitTimer = hitTimerMax;
                }
            }
        }
    void OnTriggerExit(Collider other)
    {
        Touching otherTouching = other.gameObject.GetComponent <Touching>();

        if (!otherTouching)
        {
            return;
        }

        int otherCubeId = otherTouching.cubeId;

        context.OnTouchFinish(cubeId, otherCubeId);
    }
        public virtual void PostUpdate()
        {
            lastPosition = Position;
            Position    += velocity * GameTimes.DeltaTime;
            velocity    += acceleration * GameTimes.DeltaTime;

            rotation += angularVelocity * GameTimes.DeltaTime;

            angularVelocity += angularAcceleration * GameTimes.DeltaTime;

            wasTouching = touching;
            touching    = Touching.NONE;
        }
Exemple #17
0
        internal void SetTileProperties(int tileMin, Touching allowCollisions, CollisionEventType collisionEventType, Touching direction, int tileMax = 0)
        {
            if (tileMax == 0)
            {
                tileMax = tileMin;
            }

            for (int i = tileMin; i <= tileMax; i++)
            {
                Tile tile = _tileObjects[i];

                tile.allowCollisions    = allowCollisions;
                tile.collisionEventType = collisionEventType;
            }
        }
Exemple #18
0
    // Execute before first frame
    void Start()
    {
        // Initialization
        boxColliders2D   = new List <BoxCollider2D>();
        lineRenderers    = new List <LineRenderer>();
        line_gameObjects = new List <GameObject>();

        if (node_gameObjects != null)
        {
            Array.Clear(node_gameObjects, 0, node_gameObjects.Length);
        }

        loadingFinished = false;

        isTouching = Touching.No;
        isDrawing  = Drawing.No;
    }
        public virtual void PostUpdate()
        {
            lastPosition = Position;
            Position    += velocity * GameTimes.DeltaTime;

            velocity  += acceleration * GameTimes.DeltaTime;
            velocity.X = CalculateDrag(velocity.X, drag.X);
            velocity.Y = CalculateDrag(velocity.Y, drag.Y);

            rotation += angularVelocity * GameTimes.DeltaTime;

            angularVelocity += angularAcceleration * GameTimes.DeltaTime;


            wasTouching = touching;
            touching    = Touching.NONE;
        }
Exemple #20
0
    // Execute every frame
    void Update()
    {
        if (UI_InGame.restartLevel)
        {
            ResetLevel();
            UI_InGame.restartLevel = false;
            loadingFinished        = true;
        }

        if (Generator.isDoneGenerating)
        {
            node_gameObjects = GameObject.FindGameObjectsWithTag("Node");
            ClearNodeObjectSettings();
            Generator.isDoneGenerating = false;
            loadingFinished            = true;
        }

        // If UI not present
        if (!UI_LevelPassed.UI_showing_Passed && !UI_Return.UI_showing_Return)
        {
            // Drawing lines on touching the nodes
            if (node_gameObjects != null && Input.touchCount > 0)
            {
                touch = Input.GetTouch(0);
                Vector3 touchPosition = Camera.main.ScreenToWorldPoint(touch.position);

                for (int numberOrderOfNode = 0; numberOrderOfNode < node_gameObjects.Length; numberOrderOfNode++)
                {
                    if (node_gameObjects[numberOrderOfNode].GetComponent <CircleCollider2D>().OverlapPoint(touchPosition) && areaTouchEnded && isDrawing == Drawing.No)
                    {
                        isTouching     = Touching.Node;
                        nodeTouchEnded = false;

                        StartCoroutine(DrawLine(node_gameObjects[numberOrderOfNode], numberOrderOfNode));
                    }
                    else if (numberOrderOfNode == node_gameObjects.Length - 1 && nodeTouchEnded)
                    {
                        isTouching     = Touching.Area;
                        areaTouchEnded = false;
                    }
                }
            }

            // Removing lines on touch
            if (boxColliders2D != null && Input.touchCount > 0 && touch.phase == TouchPhase.Ended)
            {
                Vector3 touchPosition = Camera.main.ScreenToWorldPoint(touch.position);

                for (int numberOrder = 0; numberOrder < boxColliders2D.Count; numberOrder++)
                {
                    if (boxColliders2D[numberOrder].GetComponent <BoxCollider2D>().OverlapPoint(touchPosition) && isDrawing == Drawing.No)
                    {
                        List <GameObject> nodeOverlaps = new List <GameObject>();

                        // Remove double line if exists
                        for (int i = 0; i < node_gameObjects.Length; i++)
                        {
                            if (node_gameObjects[i].GetComponent <CircleCollider2D>().OverlapPoint(lineRenderers[numberOrder].GetPosition(0)) ||
                                node_gameObjects[i].GetComponent <CircleCollider2D>().OverlapPoint(lineRenderers[numberOrder].GetPosition(1)))
                            {
                                nodeOverlaps.Add(node_gameObjects[i]);
                            }

                            if (i == node_gameObjects.Length - 1)
                            {
                                for (int j = 0; j < lineRenderers.Count; j++)
                                {
                                    if ((nodeOverlaps[0].GetComponent <CircleCollider2D>().OverlapPoint(lineRenderers[j].GetPosition(0)) ||
                                         nodeOverlaps[0].GetComponent <CircleCollider2D>().OverlapPoint(lineRenderers[j].GetPosition(1))) &&
                                        (nodeOverlaps[1].GetComponent <CircleCollider2D>().OverlapPoint(lineRenderers[j].GetPosition(0)) ||
                                         nodeOverlaps[1].GetComponent <CircleCollider2D>().OverlapPoint(lineRenderers[j].GetPosition(1))) &&
                                        !ReferenceEquals(lineRenderers[numberOrder], lineRenderers[j]))
                                    {
                                        RemoveNodeConnections(lineRenderers[j]);

                                        Destroy(boxColliders2D[j]);
                                        Destroy(lineRenderers[j].material);
                                        Destroy(lineRenderers[j]);
                                        Destroy(line_gameObjects[j]);

                                        boxColliders2D.RemoveAt(j);
                                        lineRenderers.RemoveAt(j);
                                        line_gameObjects.RemoveAt(j);
                                    }
                                }
                            }
                        }

                        RemoveNodeConnections(lineRenderers[numberOrder]);

                        Destroy(boxColliders2D[numberOrder]);
                        Destroy(lineRenderers[numberOrder].material);
                        Destroy(lineRenderers[numberOrder]);
                        Destroy(line_gameObjects[numberOrder]);

                        boxColliders2D.RemoveAt(numberOrder);
                        lineRenderers.RemoveAt(numberOrder);
                        line_gameObjects.RemoveAt(numberOrder);
                    }
                }
            }

            if (touch.phase == TouchPhase.Ended || isTouching == Touching.No)
            {
                nodeTouchEnded = true;
                areaTouchEnded = true;
            }
        }
    }
 // Use this for initialization
 void Start()
 {
     hand0t = hand0.GetComponent <Touching>();
     hand1t = hand1.GetComponent <Touching>();
 }
Exemple #22
0
        private void Set_init_vel(float mul = 1)
        {
            if (broom.exists)
            {
                velocity = Vector2.Zero;
                return;
            }

            if (KeyInput.IsRebindableKeyPressed(KeyFunctions.Up))
            {
                velocity.Y = -mul;
                if ((touching & Touching.UP) != 0)
                {
                    Touching tl = parent.GetTileCollisionFlags(Position + new Vector2(0, -8));
                    Touching tr = parent.GetTileCollisionFlags(Position + new Vector2(width, -8));
                    if ((Position.X + width) % 16 < 6 && (tl & Touching.DOWN) == 0)
                    {
                        additionalVel.X = -30;
                    }
                    else if ((Position.X % 16) > 9 && (tr & Touching.DOWN) == 0)
                    {
                        additionalVel.X = 30;
                    }
                }
            }
            else if (KeyInput.IsRebindableKeyPressed(KeyFunctions.Down))
            {
                velocity.Y = mul;
                if ((touching & Touching.DOWN) != 0)
                {
                    Touching bl = parent.GetTileCollisionFlags(Position + new Vector2(0, height + 8));
                    Touching br = parent.GetTileCollisionFlags(Position + new Vector2(width, height + 8));
                    if ((Position.X + width) % 16 < 6 && (bl & Touching.UP) == 0)
                    {
                        additionalVel.X = -30;
                    }
                    else if ((Position.X % 16) > 9 && (br & Touching.UP) == 0)
                    {
                        additionalVel.X = 30;
                    }
                }
            }
            else
            {
                velocity.Y = 0;
            }

            if (KeyInput.IsRebindableKeyPressed(KeyFunctions.Left))
            {
                velocity.X = -mul;
                if ((touching & Touching.LEFT) != 0)
                {
                    Touching tl2 = parent.GetTileCollisionFlags(Position + new Vector2(-8, 0));
                    Touching bl2 = parent.GetTileCollisionFlags(Position + new Vector2(-8, height));
                    if ((Position.Y + height) % 16 < 6 && (tl2 & Touching.RIGHT) == 0)
                    {
                        additionalVel.Y = -30;
                    }
                    else if (Position.Y % 16 > 9 && (bl2 & Touching.RIGHT) == 0)
                    {
                        additionalVel.Y = 30;
                    }
                }
            }
            else if (KeyInput.IsRebindableKeyPressed(KeyFunctions.Right))
            {
                velocity.X = mul;
                if ((touching & Touching.RIGHT) != 0)
                {
                    Touching tr2 = parent.GetTileCollisionFlags(Position + new Vector2(width + 8, 0));
                    Touching br2 = parent.GetTileCollisionFlags(Position + new Vector2(width + 8, height));
                    if ((Position.Y + height) % 16 < 6 && (tr2 & Touching.LEFT) == 0)
                    {
                        additionalVel.Y = -30;
                    }
                    else if (Position.Y % 16 > 9 && (br2 & Touching.LEFT) == 0)
                    {
                        additionalVel.Y = 30;
                    }
                }
            }
            else
            {
                velocity.X = 0;
            }

            velocity *= walkSpeed /* c_vel*/;
            if (velocity.X != 0 && velocity.Y != 0)
            {
                velocity *= 0.7f;
            }
        }
Exemple #23
0
 public override void Conveyor(Touching direction)
 {
     Activate();
 }
Exemple #24
0
 public Cell GetAdjacent(Touching a)
 {
     return this._adjacent[(int) a];
 }
        public Entity Build()
        {
            var width  = 0.5f;
            var height = 1f;

            var widthPixels  = (int)(width * Transform.PIXELS_A_METRE);
            var heightPixels = (int)(height * Transform.PIXELS_A_METRE);

            var sensorWidthRatio    = 0.2f;
            var sensorLopOff        = 0.9f;
            var sensorWidth         = width * sensorWidthRatio;
            var sensorWidthPixels   = (int)(sensorWidth * Transform.PIXELS_A_METRE);
            var clamberSensorOffset = 1.5f;

            var roomToStandDetector = new Touching();
            var groundDetector      = new Touching();
            var ceilingDetector     = new Touching();
            var leftWallDetector    = new Touching();
            var rightWallDetector   = new Touching();
            var clamberDetector     = new Touching();

            var clamberRightAnimation = ClamberAnimation().Create();
            var clamberLeftAnimation  = ClamberAnimation()
                                        .ReflectHorizontal()
                                        .Create();

            var rollRightAnimation = RollAnimation()
                                     .Create();
            var rollLeftAnimation = RollAnimation()
                                    .ReflectHorizontal()
                                    .ReflectRotation()
                                    .Create();

            var slideDownRightAnimation = SlideDownAnimation()
                                          .Create();

            var slideDownLeftAnimation = SlideDownAnimation()
                                         .ReflectHorizontal()
                                         .ReflectRotation()
                                         .Create();

            var slideUpRightAnimation = SlideDownAnimation()
                                        .Reversed()
                                        .Create();

            var slideUpLeftAnimation = SlideDownAnimation()
                                       .Reversed()
                                       .ReflectHorizontal()
                                       .ReflectRotation()
                                       .Create();

            var diveRightAnimation = DiveAnimation()
                                     .Create();

            var diveLeftAnimation = DiveAnimation()
                                    .ReflectRotation()
                                    .Create();

            var animator = new AnimationContainer()
                           .Add(Animations.Name(PlayerAnimation.Clamber, Direction.Right), clamberRightAnimation)
                           .Add(Animations.Name(PlayerAnimation.Clamber, Direction.Left), clamberLeftAnimation)

                           .Add(Animations.Name(PlayerAnimation.Roll, Direction.Left), rollLeftAnimation)
                           .Add(Animations.Name(PlayerAnimation.Roll, Direction.Right), rollRightAnimation)

                           .Add(Animations.Name(PlayerAnimation.SlideDown, Direction.Right), slideDownRightAnimation)
                           .Add(Animations.Name(PlayerAnimation.SlideUp, Direction.Right), slideUpRightAnimation)
                           .Add(Animations.Name(PlayerAnimation.SlideDown, Direction.Left), slideDownLeftAnimation)
                           .Add(Animations.Name(PlayerAnimation.SlideUp, Direction.Left), slideUpLeftAnimation)

                           .Add(Animations.Name(PlayerAnimation.Dive, Direction.Right), diveRightAnimation)
                           .Add(Animations.Name(PlayerAnimation.Dive, Direction.Left), diveLeftAnimation);

            return(EntityBuilder.New()
                   .WithTag(Tags.PLAYER)
                   .WithTag(Tags.CHARACTER)
                   .WithTexture(TextureUtil.CreateTexture(widthPixels, heightPixels, Color.White))
                   .With(LoadStats())
                   .With(new CharacterInfo()
            {
                CeilingDetector = ceilingDetector,
                ClamberDetector = clamberDetector,
                GroundDetector = groundDetector,
                LeftWallDetector = leftWallDetector,
                RightWallDetector = rightWallDetector,
                RoomToStandDetector = roomToStandDetector
            })
                   .With(new CharacterInput())
                   .With(new Move())
                   .With(animator)

                   .WithChild(EntityBuilder.New(false, true, true)
                              //Add the ground detector (bar below)
                              .WithChild(EntityBuilder.New()
                                         .With(ColliderBuilder.New().BoxShape(width * sensorLopOff, sensorWidth).IsTrigger().Create())
                                         .With(groundDetector)
                                         .WithTexture(TextureUtil.CreateTexture(widthPixels, sensorWidthPixels, Color.Red))
                                         .AtPosition(new Vector2(0, height * 0.5f + sensorWidth * 0.5f)))

                              //Add the ceiling detector (bar above)
                              .WithChild(EntityBuilder.New()
                                         .With(ColliderBuilder.New().BoxShape(width * sensorWidth, sensorWidth).IsTrigger().Create())
                                         .With(ceilingDetector)
                                         .WithTexture(TextureUtil.CreateTexture(widthPixels, sensorWidthPixels, Color.Red))
                                         .AtPosition(-new Vector2(0, height * 0.5f + sensorWidth * 0.5f)))

                              //Add the room to stand detector (box above)
                              .WithChild(EntityBuilder.New()
                                         .With(ColliderBuilder.New().BoxShape(width * sensorWidth, sensorWidth).IsTrigger().Create())
                                         .With(ceilingDetector)
                                         .WithTexture(TextureUtil.CreateTexture(widthPixels, sensorWidthPixels, Color.Red))
                                         .AtPosition(-new Vector2(0, height * 0.75f + sensorWidth * 0.5f)))

                              //Add the left wall detector (bar down left side)
                              .WithChild(EntityBuilder.New()
                                         .With(ColliderBuilder.New().BoxShape(sensorWidth, height * sensorLopOff).IsTrigger().Create())
                                         .With(leftWallDetector)
                                         .WithTexture(TextureUtil.CreateTexture(sensorWidthPixels, heightPixels, Color.Red))
                                         .AtPosition(-new Vector2(width * 0.5f + sensorWidth * 0.5f, 0)))

                              //Add the right wall detector (bar down right side)
                              .WithChild(EntityBuilder.New()
                                         .With(ColliderBuilder.New().BoxShape(sensorWidth, height * sensorLopOff).IsTrigger().Create())
                                         .With(rightWallDetector)
                                         .WithTexture(TextureUtil.CreateTexture(sensorWidthPixels, heightPixels, Color.Red))
                                         .AtPosition(new Vector2(width * 0.5f + sensorWidth * 0.5f, 0)))

                              //Add the clamber detector (bar over top, extending out sides)
                              .WithChild(EntityBuilder.New()
                                         .With(ColliderBuilder.New().BoxShape(width * 3f * sensorLopOff, sensorWidth).IsTrigger().Create())
                                         .With(clamberDetector)
                                         .WithTexture(TextureUtil.CreateTexture(widthPixels * 3, sensorWidthPixels, Color.Red))
                                         .AtPosition(-new Vector2(0, (height * 0.5f + sensorWidth * 0.5f) * clamberSensorOffset))))
                   .AtPosition(new Vector2(0, -10))
                   .With(ColliderBuilder.New().BoxShape(width, height).IsDynamic().IsFixedRotation(true).Create())
                   .With(new StateMachine()
                         .WithTransition(MOVE_STATE, new Transition()
                                         .WithComponent <Move>()
                                         .WithoutComponent <Clamber>()
                                         .WithoutComponent <Dive>()
                                         .WithoutComponent <Roll>()
                                         .WithoutComponent <Slide>())
                         .WithTransition(SLIDE_STATE, new Transition()
                                         .WithComponent <Slide>()
                                         .WithoutComponent <Clamber>()
                                         .WithoutComponent <Dive>()
                                         .WithoutComponent <Move>()
                                         .WithoutComponent <Roll>())
                         .WithTransition(ROLL_STATE, new Transition()
                                         .WithComponent <Roll>()
                                         .WithoutComponent <Clamber>()
                                         .WithoutComponent <Dive>()
                                         .WithoutComponent <Move>()
                                         .WithoutComponent <Slide>())
                         .WithTransition(DIVE_STATE, new Transition()
                                         .WithComponent <Dive>()
                                         .WithoutComponent <Clamber>()
                                         .WithoutComponent <Move>()
                                         .WithoutComponent <Roll>()
                                         .WithoutComponent <Slide>())
                         .WithTransition(CLAMBER_STATE, new Transition()
                                         .WithComponent <Clamber>()
                                         .WithoutComponent <Dive>()
                                         .WithoutComponent <Move>()
                                         .WithoutComponent <Roll>()
                                         .WithoutComponent <Slide>()))
                   .Create());
        }