示例#1
0
    // Use this for initialization
    void Start()
    {
        soccerHolder = transform.Find("soccerHolder").gameObject;
        soccer       = soccerHolder.transform.Find("soccer").gameObject;
        rb           = soccer.GetComponent <Rigidbody> ();
        fillAmount   = SoccerSpeed / soccerMaxSpeed;

        ethan        = GetComponentInChildren <Ethan> ();
        shootTrigger = ethan.shootDone;
    }
示例#2
0
    void Start()
    {
        VictimBlueprint ethan = new Ethan();

        //make the builder and give him ethan as the blueprint to build
        VictimBuilder builder = new VictimBuilder(ethan);

        builder.BuildVictim();

        //test
        Debug.Log(ethan.GetStatus().head);
        Debug.Log(ethan.GetStatus().torso);
        Debug.Log(ethan.GetStatus().arms);
        Debug.Log(ethan.GetStatus().legs);

        /*
         * fields won't be strings in the actualy implementation
         * and fields will likely be their own data structure. To keep this
         * test applicable, replace with a ToString() function attached to the body part class
         */
    }
示例#3
0
    void OnGUI()
    {
        GUI.skin = GuiSkin;

        // Outline Normals
        GUILayout.BeginArea(new Rect(new Rect(Screen.width - 310, 20, 310 - 20, 30)));

        GUILayout.BeginHorizontal();
        GUILayout.Label("Demo Character:");
        if (GUILayout.Button("Ethan", mViewRobot ? "Button" : "ButtonOn"))
        {
            mViewRobot = false;
            Robot.SetActive(false);
            Ethan.SetActive(true);
            DemoView.CharacterTransform = Ethan.transform;
        }
        if (GUILayout.Button("Robot Kyle", !mViewRobot ? "Button" : "ButtonOn"))
        {
            mViewRobot = true;
            Robot.SetActive(true);
            Ethan.SetActive(false);
            DemoView.CharacterTransform = Robot.transform;
        }
        GUILayout.EndHorizontal();
        GUILayout.EndArea();

        GUILayout.BeginArea(new Rect(new Rect(Screen.width - 310, 55, 310 - 20, Screen.height - 40 - 90)));
        if (mViewRobot)
        {
            GUILayout.Label("Outline Normals");
            mRobotOutlineNormals = !GUILayout.Toggle(!mRobotOutlineNormals, "Regular Normals");
            mRobotOutlineNormals = GUILayout.Toggle(mRobotOutlineNormals, "TCP2's Encoded Smoothed Normals");

            GUILayout.Label("Toony Colors Pro 2 introduces an innovative way to fix broken outline caused by hard-edge shading.\nRead the documentation to learn more!", "SmallLabelShadow");
            var r2 = GUILayoutUtility.GetLastRect();
            GUI.Label(r2, "Toony Colors Pro 2 introduces an innovative way to fix broken outline caused by hard-edge shading.\nRead the documentation to learn more!", "SmallLabel");
        }
        GUILayout.EndArea();

        //Quality Settings
        GUILayout.BeginArea(new Rect(new Rect(Screen.width - 210, Screen.height - 60, 210 - 20, 50)));
        GUILayout.Label("Quality Settings:");
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("<", GUILayout.Width(26)))
        {
            QualitySettings.DecreaseLevel(true);
        }
        GUILayout.Label(QualitySettings.names[QualitySettings.GetQualityLevel()], "LabelCenter");
        if (GUILayout.Button(">", GUILayout.Width(26)))
        {
            QualitySettings.IncreaseLevel(true);
        }
        GUILayout.EndHorizontal();
        GUILayout.EndArea();

        // TCP2 Settings
        GUILayout.BeginArea(new Rect(20, 20 + 90, Screen.width - 40, Screen.height - 40));

        mUnityShader = GUILayout.Toggle(mUnityShader, "View with Unity " + (mViewRobot ? "\"Diffuse Specular\"" : "\"Bumped Specular\""));
        GUILayout.Space(10);

        GUI.enabled = !mUnityShader;

        GUILayout.Label("Toony Colors Pro 2 Settings");
        mShaderSpecular = GUILayout.Toggle(mShaderSpecular, "Specular");

        GUI.enabled = !mViewRobot;
        if (GUI.enabled)
        {
            mShaderBump = GUILayout.Toggle(mShaderBump, "Bump");
        }
        else
        {
            GUILayout.Toggle(false, "Bump");
        }
        GUI.enabled       = !mUnityShader;
        mShaderReflection = GUILayout.Toggle(mShaderReflection, "Reflection");

        var changed = mShaderRim;

        mShaderRim = GUILayout.Toggle(mShaderRim, "Rim Lighting");
        changed    = changed != mShaderRim;
        if (changed && mShaderRim && mShaderRimOutline)
        {
            mShaderRimOutline = false;
        }
        if (changed && mShaderRim)
        {
            RestoreRimColors();
        }

        changed           = mShaderRimOutline;
        mShaderRimOutline = GUILayout.Toggle(mShaderRimOutline, "Rim Outline");
        changed           = changed != mShaderRimOutline;
        if (changed && mShaderRimOutline && mShaderRim)
        {
            mShaderRim = false;
        }
        if (changed && mShaderRimOutline)
        {
            RimOutlineColor();
        }

        GUI.enabled &= mShaderRim || mShaderRimOutline;
        GUILayout.BeginHorizontal();
        GUILayout.Label("Rim Min", GUILayout.Width(70));
        mRimMin = GUILayout.HorizontalSlider(mRimMin, 0f, 1f, GUILayout.Width(130f));
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Rim Max", GUILayout.Width(70));
        mRimMax = GUILayout.HorizontalSlider(mRimMax, 0f, 1f, GUILayout.Width(130f));
        GUILayout.EndHorizontal();
        GUI.enabled = !mUnityShader;

        mShaderOutline = GUILayout.Toggle(mShaderOutline, "Outline");

        GUILayout.Space(6);

        GUILayout.Label("Ramp Settings");
        mRampTextureFlag = GUILayout.Toggle(mRampTextureFlag, "Textured Ramp");

        GUI.enabled &= mRampTextureFlag;
        GUILayout.BeginHorizontal();
        var r = GUILayoutUtility.GetRect(200, 20, GUILayout.ExpandWidth(false));

        r.y += 4;
        GUI.DrawTexture(r, mRampTexture);
        if (GUILayout.Button("<", GUILayout.Width(26)))
        {
            PrevRamp();
        }
        if (GUILayout.Button(">", GUILayout.Width(26)))
        {
            NextRamp();
        }
        GUILayout.EndHorizontal();

        GUI.enabled  = !mUnityShader;
        GUI.enabled &= !mRampTextureFlag;
        GUILayout.BeginHorizontal();
        GUILayout.Label("Smoothing", GUILayout.Width(85));
        mRampSmoothing = GUILayout.HorizontalSlider(mRampSmoothing, 0.01f, 1f, GUILayout.Width(115f));
        GUILayout.EndHorizontal();

        if (GUI.changed)
        {
            if (mUnityShader)
            {
                UnityDiffuseShader();
            }
            else
            {
                UpdateShader();
            }
        }

        // Light Settings
        GUI.enabled = true;
        GUILayout.Space(10);
        GUILayout.Label("Light Rotation");
        mLightRotationX = GUILayout.HorizontalSlider(mLightRotationX, 0f, 360f, GUILayout.Width(200f));
        mLightRotationY = GUILayout.HorizontalSlider(mLightRotationY, 0f, 360f, GUILayout.Width(200f));

        GUILayout.Space(4);
        GUILayout.Label("Hold Left mouse button to rotate character", "SmallLabelShadow");
        r = GUILayoutUtility.GetLastRect();
        GUI.Label(r, "Hold Left mouse button to rotate character", "SmallLabel");
        GUILayout.Label("Hold Right/Middle mouse button to scroll", "SmallLabelShadow");
        r = GUILayoutUtility.GetLastRect();
        GUI.Label(r, "Hold Right/Middle mouse button to scroll", "SmallLabel");
        GUILayout.Label("Use mouse scroll wheel or up/down keys to zoom", "SmallLabelShadow");
        r = GUILayoutUtility.GetLastRect();
        GUI.Label(r, "Use mouse scroll wheel or up/down keys to zoom", "SmallLabel");

        if (GUI.changed)
        {
            var angle = DirLight.transform.eulerAngles;
            angle.y = mLightRotationX;
            angle.x = mLightRotationY;
            DirLight.transform.eulerAngles = angle;
        }

        GUILayout.EndArea();
    }