示例#1
0
 void Update()
 {
     if (Shake.shake_intensity > 0)
     {
         Vector3    pos;
         Quaternion rot;
         Shake.DoShake(originRotation, out pos, out rot);
         mainCamera.transform.localPosition = pos;
         mainCamera.transform.localRotation = rot;
     }
     else
     {
         mainCamera.transform.localPosition = Vector3.zero;
         mainCamera.transform.localRotation = originRotation;
     }
 }
示例#2
0
    public void OnPointerEnter(PointerEventData eventData)
    {
        pointerEnterCount++;
        if (pointerEnterCount == 5)
        {
            pointerEnterCount = 0;

            Shake camShake = nightmare.dreamBackground.GetComponent <Shake>();
            if (!camShake.isShaking())
            {
                camShake.DoShake();
            }

            nightmare.dupCount++;
            nightmare.initDeleteButton();
        }

        targetPosition = new Vector3(nightmare.minX + UnityEngine.Random.value * nightmare.size.x,
                                     nightmare.minY + UnityEngine.Random.value * nightmare.size.y, 0f);
    }
    void OnCollisionEnter(Collision coll)
    {
        float timeSinceShake = Time.time - lastShakeTime;

        if (jumpAndShake && CheckWallCollision(coll) && timeSinceShake > 1)
        {
            cameraShake.DoShake();
            lastShakeTime = Time.time;
        }


        if (landed)
        {
            return;
        }
        if (coll.gameObject.name == "Floor" || coll.gameObject.name == "RightWall")
        {
            Invoke("RunJumpAroundAfterDelay", 2);
            landed = true;
        }
    }