コード例 #1
0
    void AttackAct()
    {
        vibration.StartShaking(new Vector3(xVibe, yVibe, zVibe), new Quaternion(xRot, yRot, zRot, 1), speed, diminish, numberOfShakes);
        Attack();
        PlayerHealth.currentHealth -= 0.5f;
        //돌아보는 방향을 플레이어 쪽으로
        transform.rotation =
            Quaternion.Slerp(transform.rotation,
                             Quaternion.LookRotation(Target.transform.position - transform.position), Time.smoothDeltaTime * 5.0f);
        float distance = Vector3.Distance(Target.transform.position, transform.position);

        //거리가 멀어지면 탐색 실패
        if (distance > 10)
        {
            isSearch = false;
        }
    }
コード例 #2
0
    void OnGUI()
    {
        GUILayout.BeginArea(new Rect(Screen.width / 4, 10, Screen.width / 2, Screen.height));
        // User input for shake values
        GUILayout.BeginHorizontal();
        GUILayout.Label("X Vibration");
        xVibe = GUILayout.HorizontalSlider(xVibe, -2.0f, 2.0f);
        GUILayout.Label("\t" + xVibe.ToString("F2"));
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Y Vibration");
        yVibe = GUILayout.HorizontalSlider(yVibe, -2.0f, 2.0f);
        GUILayout.Label("\t" + yVibe.ToString("F2"));
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Z Vibration");
        zVibe = GUILayout.HorizontalSlider(zVibe, -2.0f, 2.0f);
        GUILayout.Label("\t" + zVibe.ToString("F2"));
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("X Rotation");
        xRot = GUILayout.HorizontalSlider(xRot, -2.0f, 2.0f);
        GUILayout.Label("\t" + xRot.ToString("F2"));
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Y Rotation");
        yRot = GUILayout.HorizontalSlider(yRot, -2.0f, 2.0f);
        GUILayout.Label("\t" + yRot.ToString("F2"));
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Z Rotation");
        zRot = GUILayout.HorizontalSlider(zRot, -2.0f, 2.0f);
        GUILayout.Label("\t" + zRot.ToString("F2"));
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Speed");
        speed = GUILayout.HorizontalSlider(speed, 10.0f, 150.0f);
        GUILayout.Label("\t" + speed.ToString("F2"));
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Decrease Multiplier");
        diminish = GUILayout.HorizontalSlider(diminish, 0.0f, 1.0f);
        GUILayout.Label("\t" + diminish.ToString("F2"));
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Number of Shakes");
        numberOfShakes = (int)GUILayout.HorizontalSlider(numberOfShakes, 1, 25);
        GUILayout.Label("\t" + numberOfShakes);
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Random Position Min");
        randomMin = GUILayout.HorizontalSlider(randomMin, -2.0f, 2.0f);
        GUILayout.Label("\t" + randomMin.ToString("F2"));
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Random Position Max");
        randomMax = GUILayout.HorizontalSlider(randomMax, -2.0f, 2.0f);
        GUILayout.Label("\t" + randomMax.ToString("F2"));
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Random Rotation Min");
        randomRotationMin = GUILayout.HorizontalSlider(randomRotationMin, -2.0f, 2.0f);
        GUILayout.Label("\t" + randomRotationMin.ToString("F2"));
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Random Rotation Max");
        randomRotationMax = GUILayout.HorizontalSlider(randomRotationMax, -2.0f, 2.0f);
        GUILayout.Label("\t" + randomRotationMax.ToString("F2"));
        GUILayout.EndHorizontal();

        // Shake and Shake Random buttons
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Shake", GUILayout.Height(50)))
        {
            vibration.StartShaking(new Vector3(xVibe, yVibe, zVibe), new Quaternion(xRot, yRot, zRot, 1), speed, diminish, numberOfShakes);
        }
        if (GUILayout.Button("Shake Random", GUILayout.Height(50)))
        {
            vibration.StartShakingRandom(randomMin, randomMax, randomRotationMin, randomRotationMax);
        }
        GUILayout.EndHorizontal();
        GUILayout.EndArea();
    }