void Start() { GameObject g = GameObject.Find("PlayerCanvas"); this.player = g.GetComponent <Player>(); this.player.registerObject(this); this.isActive = false; this.determineState(); // false is off this.actions = new List <Action>(); this.activities = new List <Activity>(); // set the max intensity of the light this.maxIntensity = 1.0F; this.minIntensity = 0.1F; // add list of activities and actions Action lightAction = new TurnLight(this, gameObject); this.actions.Add(lightAction); }
void Update() { if (Input.GetMouseButtonDown(0)) { WWWFormScore thingconnection = (WWWFormScore)gameObject.AddComponent(typeof(WWWFormScore)); GetText haeteksti = (GetText)gameObject.AddComponent(typeof(GetText)); GetTemperature temperature = (GetTemperature)gameObject.AddComponent(typeof(GetTemperature)); TurnLight valo = (TurnLight)gameObject.AddComponent(typeof(TurnLight)); Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100.0f)) { this.Nimi = hit.transform.name; ShowThisGUI = true; Debug.Log("Pisteessa " + hit.point + " on " + hit.transform.name + " ja arvo on : " + value); } } }