Exemplo n.º 1
0
 public void aracnoSense(Vector3 _target, float _time, float _alpha)
 {
     if (ServiceLocator.Request <IGameplayService>().GetGameMode() == GameMode.GoalKeeper)
     {
         crossHair cross = (crossHair(_target).GetComponent <crossHair>());
         cross.time  = _time;
         cross.alpha = _alpha;
     }
 }
 // Use this for initialization
 void Start()
 {
     _crosshair = crossHair.FindObjectOfType <crossHair>();
     _crosshair.emptyData();
     _crosshair.setCurrenceSceneNum(scene_num);
 }
    // Use this for initialization
    void Start()
    {
        select_scene();

        Vector3 offset = new Vector3(-width / 2.0f, height / 2.0f, distanceFromEye);

        GameObject   newLineGen = Instantiate(lineGerneratorPrefab);
        LineRenderer lRend      = newLineGen.GetComponent <LineRenderer>();

        lRend.positionCount = pos.Length;
        int index   = 0;
        int index_2 = 0;
        // for data bus
        List <string> nameList  = new List <string>();
        List <int>    valueList = new List <int>();

        GameObject lastObject = new GameObject();

        for (int i = 0; i < pos.GetLength(0); i++)
        {
            GameObject   newLineGen_2 = Instantiate(lineGerneratorPrefab2);
            LineRenderer lRend_2      = newLineGen_2.GetComponent <LineRenderer>();
            index_2 = 0;

            for (int j = 0; j < pos.GetLength(1); j++)
            {
                // new number cube location diff from offset
                Vector3 vec = new Vector3(width * (float)pos[i, j], -height * i / pos.GetLength(0), (float)dis[i, j]);
                // final position after add all adjustment.
                Vector3 newPos = eyePosition.position + vec + offset;

                // generate number object
                GameObject projectile = Instantiate(spawnee, newPos, eyePosition.rotation);
                projectile.transform.rotation = Quaternion.Euler(0, 0, 0);

                // apply texture
                int texture_index = Random.Range(0, 10);
                projectile.GetComponent <Renderer>().material.mainTexture = textures[texture_index];

                // add canvas to be number parent
                string name = index.ToString() + 'a' + texture_index.ToString();
                projectile.name = name;
                //lastObject = projectile;

                // store object id and value to Databus
                nameList.Add(name);

                if (currentScene == 1)
                {
                    lRend.SetPosition(index, newPos);
                    index++;
                }
                if (currentScene == 2)
                {
                    lRend_2.positionCount = pos.GetLength(1);
                    lRend_2.SetPosition(index_2, newPos);
                    index_2++;
                }
            }
        }
        //lastObject.name = "0a0";

        _crosshair = crossHair.FindObjectOfType <crossHair>();
        _crosshair.update_crosshair(nameList, valueList, currentScene);
    }