Пример #1
0
    //--------------------------------------------------


    //--------------------------------------------------
    void Start()
    //--------------------------------------------------
    {
        lineRend = GetComponent <LineRenderer> ();
        simulationRoverManager = GetComponentInParent <SimulationRoverManager>();
        roverCameraManager     = simulationRoverManager.GetComponent <RoverCameraManager> ();
    }
Пример #2
0
    //--------------------------------------------------

    //--------------------------------------------------
    private void Start()
    //--------------------------------------------------
    {
        simulationRoverManager = GetComponentInParent <SimulationRoverManager>();
        simulationManager      = GameObject.Find("SimulationManager").GetComponent <SimulationManager>();
        roverCameraManager     = simulationRoverManager.GetComponent <RoverCameraManager>();
        roverManagerList       = simulationManager.GetRoverManagerList();

        //grabbing colors from list of rovers
        for (int i = 0; i < roverManagerList.Count; i++)
        {
            roverColorsList.Add(roverManagerList[i].GetRoverColor());
        }

        //setting alpha value of all colors in the list
        for (int i = 0; i < roverColorsList.Count; i++)
        {
            Color tempColor = roverColorsList[i];
            tempColor.a        = highLightAlpha;
            roverColorsList[i] = tempColor;
        }

        roverID               = simulationRoverManager.GetRoverID();
        roverHighlightColor   = simulationRoverManager.GetRoverColor();
        roverHighlightColor.a = highLightAlpha;

        lineRend = GetComponent <LineRenderer>();
        lineRend.material.SetColor("_TintColor", roverHighlightColor);
    }
Пример #3
0
    //--------------------------------------------------

    //--------------------------------------------------
    private void RepresentData(GameObject curSlice, SimulationRoverManager curRover)
    //--------------------------------------------------
    {
        Renderer renderer = curSlice.GetComponent <Renderer>();

        renderer.GetPropertyBlock(m_propertyBlock);

        m_propertyBlock.Clear();

        float curOxygen = curRover.CurrentOxygenReading();
        Color dataColor = new Color(
            Color.blue.r,
            Color.blue.g,
            Color.blue.b,
            curOxygen / 255f);

        m_propertyBlock.SetColor("_Color", dataColor);

        renderer.SetPropertyBlock(m_propertyBlock);

        renderer.enabled = m_renderingEnabled;
    }
Пример #4
0
    //--------------------------------------------------

    //--------------------------------------------------
    public GameObject InstantiateRover(
        int id,
        ref List <float> timestamps,
        ref Dictionary <float, Vector3> positions,
        ref Dictionary <float, Quaternion> rotations)
    //--------------------------------------------------
    {
        GameObject curRover = Instantiate(m_roverPrefab, null);

        m_rovers.Add(curRover);

        SimulationRoverManager roverManager =
            curRover.GetComponent <SimulationRoverManager>();

        m_roverManagers.Add(roverManager);

        int   colorIndex = m_rovers.Count - 1;
        Color curRoverColor;

        if (colorIndex >= m_roverColors.Length)
        {
            curRoverColor = new Color(
                UnityEngine.Random.Range(0f, 255f),
                UnityEngine.Random.Range(0f, 255f),
                UnityEngine.Random.Range(0f, 255f));
        }
        else
        {
            curRoverColor = m_roverColors[colorIndex];
        }

        roverManager.InitializeVariables(
            id, ref timestamps, ref positions, ref rotations, ref curRoverColor);

        curRover.GetComponent <RoverCameraManager>().SetCameraViewParameters(cameraFieldOfView, cameraDepthOfView);

        return(curRover);
    }