Exemple #1
0
    public static void Main()
    {
        // Sample input for the outliner
        var input = new List <Heading>()
        {
            new Heading(1, "Title1"),
            new Heading(2, "Something"),
            new Heading(2, "Something2"),
            new Heading(3, "SomethingElse"),
            new Heading(2, "Something3"),
            new Heading(3, "SomethingElse2"),
            new Heading(2, "Something4"),
            new Heading(2, "Something5"),
            new Heading(2, "Something6"),
            new Heading(3, "SomethingElse3"),
            new Heading(4, "FinalSomething"),
            new Heading(3, "SomethingElse4"),
            new Heading(3, "SomethingElse5"),
            new Heading(1, "Title2"),
            new Heading(2, "Something"),
            new Heading(2, "Something2"),
            new Heading(1, "Title3"),
            new Heading(2, "Something"),
        };

        var output = Outliner.CreateOutline(input);

        printAnswer(output);

        Console.WriteLine("\n\nPress Any Key To Exit");
        Console.ReadKey();
    }
Exemple #2
0
    private void Update()
    {
        canMoveX = Physics.CheckSphere(movePoint.position + new Vector3(Input.GetAxisRaw("Horizontal"), -0.75f, 0f), 0.2f, moveableLayer);
        canMoveZ = Physics.CheckSphere(movePoint.position + new Vector3(0f, -0.75f, Input.GetAxisRaw("Vertical")), 0.2f, moveableLayer);

        Collider[] stairsX = Physics.OverlapSphere(movePoint.position + new Vector3(Input.GetAxisRaw("Horizontal"), -0.75f, 0f), 0.2f, stairs);
        Collider[] stairsZ = Physics.OverlapSphere(movePoint.position + new Vector3(0f, -0.75f, Input.GetAxisRaw("Vertical")), 0.2f, stairs);

        groundRight = Physics.OverlapSphere(transform.position + new Vector3(1f, 0.75f, 0), 0.2f, ground); //If none of these are true then the player cant use the stairs
        groundLeft  = Physics.OverlapSphere(transform.position + new Vector3(-1f, 0.75f, 0), 0.2f, ground);
        groundUp    = Physics.OverlapSphere(transform.position + new Vector3(0f, 0.75f, 1f), 0.2f, ground);
        groundDown  = Physics.OverlapSphere(transform.position + new Vector3(0f, 0.75f, -1f), 0.2f, ground);

        currentGround = Physics.OverlapSphere(transform.position + new Vector3(0f, -0.75f, 0f), 0.2f, moveableLayer);

        if (isControlled)
        {
            outliner.CreateOutline();
            playerMovement.enabled = false;

            if (Input.GetKeyDown(playerMovement.interactKey))
            {
                if (!currentGround[0].CompareTag("CantPlace"))
                {
                    playerMovement.enabled = true;
                    isControlled           = false;
                }
            }
            if (Vector3.Distance(transform.position, movePoint.position) <= 0.05f)
            {
                if (Mathf.Abs(Input.GetAxisRaw("Horizontal")) == 1)
                {
                    if (canMoveX)
                    {
                        if (stairsX.Length <= 0)
                        {
                            movePoint.position += new Vector3(Input.GetAxisRaw("Horizontal"), 0f, 0f);
                        }
                    }
                }
                else if (Mathf.Abs(Input.GetAxisRaw("Vertical")) == 1)
                {
                    if (canMoveZ)
                    {
                        if (stairsZ.Length <= 0)
                        {
                            movePoint.position += new Vector3(0f, 0f, Input.GetAxisRaw("Vertical"));
                        }
                    }
                }
            }
        }
        else
        {
            playerMovement.enabled = true;
            outliner.DeleteOutline();
        }
    }