예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (patching)
        {
            if (ActivityCheck.IsPressed(sprite.bounds, 0, Rotate.Side.RIGHT))
            {
                patchTimer += Time.deltaTime;
                if (patchTimer >= patchTime)
                {
                    // Hole patched
                    HolePatchEvent(this);
                    Destroy(gameObject);
                    patching = false;
                }
            }
            else
            {
                // Stop patching
                patching   = false;
                patchTimer = 0;
            }

            // Draw patch bar
            patchBar.enabled                = patching;
            patchBar.fillAmount             = 2 * patchTimer;
            patchBar.rectTransform.position = Input.mousePosition;
        }
        else if (ActivityCheck.IsClicked(sprite.bounds, 0, Rotate.Side.RIGHT))
        {
            // Start patching
            AudioManager.Instance.Play("metal");
            patching   = true;
            patchTimer = 0;
        }
    }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        bool isOperational = controllingModule.IsOperational();

        switch (State)
        {
        case ModuleState.WORKING:
            if (!isOperational)
            {
                // Signal break
                State = ModuleState.BROKEN;
            }
            break;

        case ModuleState.READY:
            if (!isOperational)
            {
                State = ModuleState.BROKEN;
            }
            break;

        case ModuleState.BROKEN:
            if (isOperational)
            {
                // Fixed
                State = ModuleState.READY;
            }
            break;
        }

        if (ActivityCheck.IsClicked(switchSprite.bounds, 0, Rotate.Side.FRONT))
        {
            if (State == ModuleState.READY)
            {
                State = ModuleState.WORKING;
            }
        }
    }
예제 #3
0
파일: Disk.cs 프로젝트: GeroVeni/LD-46-Game
    // Update is called once per frame
    void Update()
    {
        if (ActivityCheck.IsClicked(diskSprite.bounds, 0, Rotate.Side.FRONT))
        {
            spinning     = true;
            prevMousePos = ActivityCheck.GetMousePositionWorld() - spinCenter;
            //prevMousePos.z = 0;
        }
        else if (Input.GetMouseButtonUp(0))
        {
            spinning = false;
        }

        if (spinning)
        {
            Vector3 mousePos = ActivityCheck.GetMousePositionWorld() - spinCenter;
            //mousePos.z = 0;
            float angle = Vector3.SignedAngle(prevMousePos, mousePos, diskSprite.transform.forward);
            spinEvent(angle / (spinsToFull * 360f));
            transform.rotation *= Quaternion.AngleAxis(angle, diskSprite.transform.forward);
            prevMousePos        = mousePos;
        }
    }