Exemplo n.º 1
0
    void Start()
    {
        reader    = GetComponent <LogReader>();
        writer    = GetComponent <AnalysisWriter>();
        calulator = GetComponent <Calculator>();
        rae       = GetComponent <ReplayAnalysisEngine>();
        extender  = GetComponent <ReplayExtender>();

        gameWidth  = float.IsNaN(gameWidth) ?  Screen.height * Camera.mainCamera.aspect : gameWidth;
        originX    = (Screen.width - gameWidth) / 2f;
        gameHeight = float.IsNaN(gameHeight) ? Screen.height : gameHeight;

        overalOptionsRect = new Rect(originX, 0, gameWidth, gameHeight);
        optionsLabelRect  = new Rect(overalOptionsRect.x + overalOptionsRect.width / 2 - standardButtonWidth / 2,
                                     overalOptionsRect.y + borderSpacing,
                                     standardButtonWidth,
                                     standardButtonHeight);
        optionToolbarRect = new Rect(originX + borderSpacing,
                                     optionsLabelRect.yMax + borderSpacing,
                                     overalOptionsRect.width - 2 * borderSpacing,
                                     standardButtonHeight);

        mainOptionsRect = new Rect(overalOptionsRect.x + borderSpacing,
                                   optionToolbarRect.yMax + borderSpacing,
                                   overalOptionsRect.width - 2 * borderSpacing,
                                   overalOptionsRect.yMax - optionToolbarRect.yMax - 2 * borderSpacing - standardButtonHeight);

        optionNames.Add("Replay Options");
        optionNames.Add(reader.GUIName);
        optionNames.Add(writer.GUIName);
        optionNames.Add(calulator.GUIName);
        optionNames.Add(extender.GUIName);
    }
    // Use this for initialization
    void Start()
    {
        dictionary = GetComponent <PrefabDictionary>();

        reader = GetComponent <LogReader>();
        if (reader == null)
        {
            Debug.LogError("No LogReader attached to the Replay Analysis Engine.");
        }

        calculator = GetComponent <Calculator>();
        if (calculator == null)
        {
            Debug.LogError("No Calculator attached to the Replay Analysis Engine.");
        }

        writer = GetComponent <AnalysisWriter>();
        if (writer == null)
        {
            Debug.LogError("No LogWriter attached to the Replay Analysis Engine.");
        }

        extender = GetComponent <ReplayExtender>();
        if (extender == null)
        {
            Debug.LogWarning("No ReplayExtender attached to the Replay Analysis Engine. Adding a DummyExtender.");
        }
        this.gameObject.AddComponent <ReplayExtender>();

        foreach (GameObject go in (FindObjectsOfType(typeof(GameObject)) as GameObject[]))
        {
            if (go != this.gameObject && go.GetComponent <ReplayBehavior>() == null)
            {
                ReplayBehavior rb = go.AddComponent <ReplayBehavior>();
                rb.ReplayTag      = ReplayBehavior.RAETag.Given;
                rb.RecordTouching = false;
            }
        }
    }
Exemplo n.º 3
0
    void Start()
    {
        reader = GetComponent<LogReader>();
        writer = GetComponent<AnalysisWriter>();
        calulator = GetComponent<Calculator>();
        rae = GetComponent<ReplayAnalysisEngine>();
        extender = GetComponent<ReplayExtender>();

        gameWidth = float.IsNaN(gameWidth) ?  Screen.height * Camera.mainCamera.aspect : gameWidth;
        originX = (Screen.width - gameWidth) / 2f;
        gameHeight = float.IsNaN(gameHeight) ? Screen.height : gameHeight;

        overalOptionsRect = new Rect(originX, 0, gameWidth, gameHeight);
        optionsLabelRect = new Rect(overalOptionsRect.x + overalOptionsRect.width / 2 - standardButtonWidth / 2,
            overalOptionsRect.y + borderSpacing,
            standardButtonWidth,
            standardButtonHeight);
        optionToolbarRect = new Rect(originX + borderSpacing,
            optionsLabelRect.yMax + borderSpacing,
            overalOptionsRect.width - 2 * borderSpacing,
            standardButtonHeight);

        mainOptionsRect = new Rect(overalOptionsRect.x + borderSpacing,
            optionToolbarRect.yMax + borderSpacing,
            overalOptionsRect.width - 2 * borderSpacing,
            overalOptionsRect.yMax - optionToolbarRect.yMax - 2 * borderSpacing - standardButtonHeight);

        optionNames.Add("Replay Options");
        optionNames.Add(reader.GUIName);
        optionNames.Add(writer.GUIName);
        optionNames.Add(calulator.GUIName);
        optionNames.Add(extender.GUIName);
    }
    // Use this for initialization
    void Start()
    {
        dictionary = GetComponent<PrefabDictionary>();

        reader = GetComponent<LogReader>();
        if(reader == null)
            Debug.LogError("No LogReader attached to the Replay Analysis Engine.");

        calculator = GetComponent<Calculator>();
        if (calculator == null)
            Debug.LogError("No Calculator attached to the Replay Analysis Engine.");

        writer = GetComponent<AnalysisWriter>();
        if (writer == null)
            Debug.LogError("No LogWriter attached to the Replay Analysis Engine.");

        extender = GetComponent<ReplayExtender>();
        if (extender == null)
            Debug.LogWarning("No ReplayExtender attached to the Replay Analysis Engine. Adding a DummyExtender.");
        this.gameObject.AddComponent<ReplayExtender>();

        foreach (GameObject go in (FindObjectsOfType(typeof(GameObject)) as GameObject[])) {
            if (go != this.gameObject && go.GetComponent<ReplayBehavior>() == null) {
                ReplayBehavior rb = go.AddComponent<ReplayBehavior>();
                rb.ReplayTag = ReplayBehavior.RAETag.Given;
                rb.RecordTouching = false;
            }
        }
    }