Пример #1
0
    // Use this for initialization
    void Start()
    {
        assets = new List <GameObject>();
        // store all child assets in the array
        foreach (Transform t in GameObject.Find("TimedEvents").GetComponentsInChildren <Transform>())
        {
            if (t.name != "TimedEvents" && t.name != "AssetParticles")
            {
                assets.Add(GameObject.Find(t.name));
                Debug.Log(t.name);
                assets[assets.Count - 1].SetActive(false);
            }
        }

        state           = State.waiting;
        hasTimerStarted = false;

        hands = new List <GameObject>
        {
            GameObject.Find("HandObject")
        };

        colors    = new Color[4];
        colors[0] = Color.red;
        colors[1] = Color.blue;
        colors[2] = Color.green;
        colors[3] = Color.yellow;

        floor = GameObject.Find("FloorCamera").GetComponent <FloorSceneManager>();
    }
    // Use this for initialization
    void Start()
    {
        wallCamera = GameObject.FindGameObjectWithTag("WallCamera").GetComponent <Camera>();
        floor      = GameObject.Find("FloorCamera").GetComponent <FloorSceneManager>();

        if (!name.ToLower().Contains("clone") && !name.ToLower().Contains("floor") &&
            !name.ToLower().Contains("clouds"))
        {
            Light l = Instantiate(GameObject.Find("SelectedLight").GetComponent <Light>());
            l.transform.localPosition = transform.position + new Vector3(0, 0, 10);
            l.transform.parent        = GameObject.Find("Lights").transform;
            l.name = string.Format("Light({0})", name);
            if (name == "Sun")
            {
                l.GetComponent <Light>().range = 15;
            }
            else
            {
                l.GetComponent <Light>().range = gameObject.transform.localScale.x / .667f;
            }
            if (transform.localScale.x < 0.5)
            {
                l.GetComponent <Light>().range *= 1.5f;
            }
            range = l.GetComponent <Light>().range;
            halo  = l;
        }
        normalScale    = transform.localScale;
        ps             = GameObject.Find("HandStars");
        e              = ps.GetComponent <ParticleSystem>().emission;
        planetSelected = false;
        //if (SolarDayHours == 0)
        //    return;

        //scaledSpeed = 24f / SolarDayHours;
        scaledSpeed  = 11 - rotationRank;
        scaledSpeed /= 7;
        up           = gameObject.transform.up;
        radius       = GetComponent <SphereCollider>().radius *transform.localScale.x;

        // get all the current hands
        hands = new List <Transform>();
        StartCoroutine(WaitForHands());
    }