Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        if (lookingAtSpaceBarDrop())
        {
            showFlavorText("Press F to pick up spare space bar");
            if (Input.GetButtonDown("Fire1"))
            {
                deleteSpaceBarDrop();
                numSpaceBars += 1;
                updateSpaceBarCount();
            }
        }
        else if (lookingAtActivatable())
        {
            Activatable acti = getActivatableInFront();
            showFlavorText("Press F to " + acti.getDescription());
            if (Input.GetButtonDown("Fire1"))
            {
                Debug.Log("FIRE IN THE HOLE");
                acti.activate();
            }
        }
        else
        {
            flavorText.enabled = false;
        }

        if (shakeFadeOn)
        {
            var dt = Time.time - shakeFadeStart;
            if (dt >= shakeFadeDuration)
            {
                shakeFadeOn = false;
                shaker.transform.localEulerAngles = Vector3.zero;
            }
            else
            {
                var p = dt / shakeFadeDuration;
                if (!shakeFadeIn)
                {
                    p = 1 - p;
                }
                var dist = maxShakeDist * p;
                shaker.transform.localEulerAngles = Random.onUnitSphere * dist;
            }
        }
    }