public void SpawnPlatelet() { GameObject newPlate = (GameObject)Instantiate(plateletPrefab, plateletSpawnPoint.GetRandomPoint(), this.transform.rotation); Platelets newPlateletScript = newPlate.GetComponent <Platelets> (); newPlateletScript.currentBlock = plateletSpawnPoint; newPlateletScript.currentBlock.platelets.Add(newPlate); newPlateletScript.destination = plateletSpawnPoint.GetRandomPoint(); newPlateletScript.gameControl = this; newPlateletScript.spawnTime = Time.time; platelets.Add(newPlate.GetComponent <Platelets>()); }
// Block clicked. Send selected WhiteBloodCell here public void OnMouseOver() { showStats = true; if (dead) { return; } //Quit out if not a right click if (!Input.GetMouseButtonDown(1)) { return; } mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); foreach (GameObject obj in gameControl.selected) { if (obj.tag == "WhiteBloodCell") { WhiteBloodCell cell = obj.GetComponent <WhiteBloodCell> (); //cell.renderer.material.color = Color.white; //cell.isSelected = false; cell.SetDestination(this, mousePos); gameControl.isSelected = true; } else if (obj.tag == "Platelet") { Platelets plate = obj.GetComponent <Platelets> (); //plate.renderer.material.color = Color.yellow; //plate.isSelected = false; plate.SetDestination(this, mousePos); gameControl.isSelected = true; } } StartCoroutine(FireMouseClick()); //gameControl.selected.Clear(); }