コード例 #1
0
    private void Update()
    {
        DebugLogging.CustomDebug("så det funkar", size: 20);

        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                if (hit.transform.CompareTag("Par"))
                {
                    GatheredParasites.Add(hit.transform.GetComponent <ParasiteController>());
                    hit.transform.GetComponent <ParasiteController>().enabled = false;
                    hit.transform.gameObject.SetActive(false);
                }
            }
        }

        if (health > 0)
        {
            if (frameCount % 60 == 0)
            {
                DrainHealth();
                // Debug.Log("Health : " + health);
            }
        }
        else
        {
            Debug.Log("PlayerDead");
            Destroy(this);
            this.gameObject.SetActive(false);
        }
        frameCount++;
    }
コード例 #2
0
    void Start()
    {
        Debug.Log("A log");

        Debug.LogWarning("A Warning");

        Debug.LogError("An Error");

        Debug.Log("A <b>Bold</b> log");

        Debug.LogWarning("An <i>Italic</i> Warning");

        Debug.LogError("A <size=20> Sized up</size> Error");

        Debug.Log("A debug log with an object reference", gameObject);

        Debug.Log("A <color=red> red </color> message");

        string rainbowColored = string.Empty;
        for (int i = 0; i < rainbowMessage.Length; i++)
        {
            rainbowColored += colorprefix;
            rainbowColored += colors[UnityEngine.Random.Range(0, colors.Count - 1)];
            rainbowColored += rainbowMessage[i];
            rainbowColored += colorSufix;
        }

        Debug.Log("a <size=20>" + rainbowColored + "</size> message");

        DebugLogging.CustomDebug("A custom message", LogType.Log, "blue", 20, true, false);
        DebugLogging.CustomDebug("Another custom message", logType: LogType.Warning, color: "green", italic: true);

    }
コード例 #3
0
 void FifthFunction()
 {
     DebugLogging.CustomDebug("Our number is: " + integerThatWeFollow.ToString(), size: 15);
 }
コード例 #4
0
    public void tutorial()
    {
        switch (currentTutorialState)
        {
        case Tutorial_States.PRE_START:

            animator.SetTrigger("ZoomIn");
            currentTutorialState = Tutorial_States.START;
            break;

        case Tutorial_States.START:
            controlls_Text.text = "Press RIGHT";
            DebugLogging.CustomDebug("here");
            playerController.enabled = true;
            movmentComponent.enabled = true;

            if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow))
            {
                currentTutorialState = Tutorial_States.MOVE_RIGHT;
            }

            break;

        case Tutorial_States.MOVE_RIGHT:
            controlls_Text.text = "Press LEFT";

            if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow))
            {
                currentTutorialState = Tutorial_States.MOVE_LEFT;
            }

            break;

        case Tutorial_States.MOVE_LEFT:
            controlls_Text.text   = "Press SPACE";
            jumpComponent.enabled = true;

            if (Input.GetKeyDown(KeyCode.Space))
            {
                currentTutorialState = Tutorial_States.JUMP;
            }

            break;

        case Tutorial_States.JUMP:
            controlls_Text.text      = "RIGHT click to collect parasite in range";
            collectComponent.enabled = true;
            parasite.SetActive(true);
            paraiteMove.Move(-1);

            if (Input.GetKeyDown(KeyCode.Mouse1) && collectComponent.numberOfCollectedParasites > 0)
            {
                currentTutorialState = Tutorial_States.COLLECT;
                parasite.SetActive(false);
            }

            break;

        case Tutorial_States.COLLECT:
            controlls_Text.text   = "LEFT click fire parasite";
            fireComponent.enabled = true;

            if (Input.GetKeyDown(KeyCode.Mouse0))
            {
                currentTutorialState = Tutorial_States.FIRE;
            }

            break;

        case Tutorial_States.FIRE:
            controlls_Text.text = string.Empty;

            isTutorialRunning = false;
            animator.SetTrigger("ZoomOut");
            PanelMain.SetActive(true);

            playerController.enabled = false;
            movmentComponent.enabled = false;
            jumpComponent.enabled    = false;
            collectComponent.enabled = false;
            fireComponent.enabled    = false;

            break;
        }
    }