コード例 #1
0
    void checkKeyPress()
    {
        Vector3 tmp           = transform.position;
        float   potionBottomY = transform.position.y - GetComponent <Renderer>().bounds.size.y / 2;

        tmp.z = (player.transform.position.y <= potionBottomY + 0.7) ? 1 : -1;
        transform.position = tmp;

        float distance = Vector3.Distance(transform.position, player.transform.position);

        if (distance <= 1.5f)
        {
            playerText.SetText("(Press C to Interact)", 0.1f);
            if (Input.GetKeyDown(KeyCode.C))
            {
                GameManager.instance.firePuzzle[puzzleId] = !GameManager.instance.firePuzzle[puzzleId];
                if (GameManager.instance.firePuzzle[puzzleId])
                {
                    if (numOfEnabledFire == 0)
                    {
                        GameManager.instance.timeBtwCount = 5f;
                    }
                    else
                    {
                        GameManager.instance.timeBtwCount += 5f;
                    }
                }
            }
        }
    }
コード例 #2
0
    void Update()
    {
        if (!GameManager.instance.isPlaying)
        {
            return;
        }

        Vector3 tmp           = transform.position;
        float   potionBottomY = transform.position.y - GetComponent <Renderer>().bounds.size.y / 2;

        tmp.z = (player.transform.position.y <= potionBottomY + 0.7) ? 1 : -1;
        transform.position = tmp;

        float distance = Vector3.Distance(transform.position, player.transform.position);

        if (distance <= 1.5f)
        {
            playerText.SetText("Potion\n(Press C to pick up)", 0.1f);
            if (Input.GetKeyDown(KeyCode.C))
            {
                GameManager.instance.numberOfPotions++;
                Destroy(gameObject);
            }
        }
    }
コード例 #3
0
ファイル: DoorEventHandler.cs プロジェクト: juierror/skyrune
    void Update()
    {
        if (GameManager.instance.hasClearedRoom[roomPower])
        {
            return;
        }

        float distance = Vector3.Distance(transform.position, player.transform.position);

        if (distance <= 2f && ((GameManager.instance.pickedRune == null && GameManager.instance.enteredRoom == null) || GameManager.instance.enteredRoom != null))
        {
            playerText.SetText("Press C to enter", 0.1f);
            if (Input.GetKeyDown("c"))
            {
                if (GameManager.instance.enteredRoom == null)
                {
                    GameManager.instance.EnterDoor(roomPower);
                }
                else
                {
                    GameManager.instance.LeaveRoom();
                    if (GameManager.instance.pickedRune != null)
                    {
                        GameManager.instance.SetClearedRoom(roomPower);
                    }
                }
            }
        }
    }
コード例 #4
0
    void Update()
    {
        float distance    = Vector3.Distance(transform.position, playerTransform.position);
        float rockBottomY = transform.position.y - GetComponent <Renderer>().bounds.size.y / 2;

        if (GameManager.instance.pickedRune != null && distance <= 3.5 && playerTransform.position.y <= rockBottomY + 1)
        {
            playerText.SetText("Press C to insert rune", 0.1f);
            if (Input.GetKeyDown(KeyCode.C))
            {
                GameManager.instance.InsertRune();
            }
        }

        if (GameManager.instance.hasUnlockedAllPowers())
        {
            if (circleDelay < circleDelayTime)
            {
                circleDelay += Time.deltaTime;
            }
            else if (circleYScale < 1.2f)
            {
                BossCameraControl cam = GameObject.Find("CameraControl").GetComponent <BossCameraControl>();
                cam.ShakeCamera();
                circleYScale += Time.deltaTime * 2f;
                Vector3 scale = magicCircle.localScale;
                scale.y = circleYScale;
                magicCircle.localScale = scale;
            }
            else if (circleYScale > 2.5f)
            {
                GameManager.instance.LoadBossScene();
            }
            else
            {
                circleYScale += Time.deltaTime;
            }
        }

        if (GameManager.instance.showTutorial)
        {
            GameManager.instance.showTutorial = false;
            playerText.SetText("WASD to move\nSHIFT to dash\nLEFT MOUSE to attack\nSPACE to use potion", 8f);
        }
    }
コード例 #5
0
ファイル: RunePickup.cs プロジェクト: juierror/skyrune
    void Update()
    {
        Vector3 tmp         = transform.position;
        float   runeBottomY = transform.position.y - GetComponent <Renderer>().bounds.size.y / 2;

        tmp.z = (player.position.y <= runeBottomY + 0.7) ? 1 : -1;
        transform.position = tmp;

        if (isUnlocked)
        {
            float distance = Vector3.Distance(transform.position, player.position);
            if (distance <= 1.5f)
            {
                string name = runeType == Rune.Red ? "Fire Rune" : (runeType == Rune.Blue ? "Freeze Rune" : "Lightning Rune");
                text.SetText(name + "\n(Press C to pick up)", 0.1f);
                if (Input.GetKeyDown(KeyCode.C))
                {
                    GameManager.instance.PickUpRune(runeType);
                    Destroy(gameObject);
                }
            }
        }
    }