public void SetDragged(GearArea newGearArea, Sprite newIcon) { gearArea = newGearArea; SetGearArea(); spriteRenderer = gameObject.AddComponent <SpriteRenderer> (); spriteRenderer.sortingLayerName = "Gear"; spriteRenderer.sortingOrder = 10; icon = newIcon; followMouse = true; spriteRenderer.sprite = icon; }
//Editor public virtual void SetGearArea(GearArea newGearArea) { gearArea = newGearArea; foreach (Vector2 pos in gearArea.addArea) { Vector2 newPos = SetNewPosition(pos); GameObject gearAreaObject = Instantiate(StoreController.singleton.addAreaPrefab) as GameObject; SetAreaObject(gearAreaObject, newPos); gearAreaObjects.Add(gearAreaObject); } foreach (Vector2 pos in gearArea.blockArea) { Vector2 newPos = SetNewPosition(pos); GameObject gearAreaObject = Instantiate(StoreController.singleton.blockAreaPrefab) as GameObject; SetAreaObject(gearAreaObject, newPos); gearAreaObjects.Add(gearAreaObject); } }