public void stopDragging() { Destroy(mouseFollowingSprite); mouseFollowingSprite = null; nanobotPrefab = null; CellHighlighter.clearHighlights(); }
public void clickNanobot(Nanobot nanobotPrefab) { if (SoundManager.instance != null) { SoundManager.instance.PlaySingle(GetComponent <AudioSource>(), selectBotSound); } if (mouseFollowingSprite != null) { Destroy(mouseFollowingSprite); } this.nanobotPrefab = nanobotPrefab; mouseFollowingSprite = new GameObject(); mouseFollowingSprite.AddComponent <SpriteRenderer>().sprite = nanobotPrefab.GetComponent <SpriteRenderer>().sprite; mouseFollowingSprite.GetComponent <SpriteRenderer>().sortingOrder = 3; mouseFollowingSprite.transform.localScale = new Vector3(0.5f, 0.5f, 1); Vector3 position = Camera.main.ScreenToWorldPoint(Input.mousePosition); mouseFollowingSprite.transform.position = new Vector3(position.x, position.y, mouseFollowingSprite.transform.position.z); CellHighlighter.triggerHighlights(); }
public void Awake() { this.cellHighlighter = GameObject.Find(Constants.CELL_HIGHLIGHTER_NAME).GetComponent <CellHighlighter>(); }