// Use this for initialization void Start () { parentUI = transform.parent.gameObject.GetComponent<RhythmUI>(); state = RhythmUI.arrowState.normal; Material newMaterial = new Material(this.gameObject.GetComponent<Image>().material); this.gameObject.GetComponent<Image>().material = newMaterial; }
public void DoStuff(RhythmUI.arrowState command, RhythmUI.arrowType commandType, Sprite newSprite = null) { state = command; stateOffset = Time.time; type = commandType; if (newSprite != null) { this.GetComponent<Image>().overrideSprite = newSprite; Vector3 destination = this.gameObject.transform.localPosition; Vector3 rotation = new Vector3(0, 0, 0); Quaternion rotationQuat = Quaternion.identity; rotationQuat.eulerAngles = rotation; this.gameObject.transform.SetPositionAndRotation(destination, rotationQuat); this.gameObject.transform.localPosition = destination; } // Debug.Log("Arrow " + reference + " " + command); }