/// <summary> /// Initializes the AttackWarning component (called from the AttackWarningManager) /// </summary> public void Init(AttackWarningManager manager, Vector3 targetPosition) { this.manager = manager; this.targetPosition = targetPosition; imageUI = gameObject.GetComponent <Image>(); Assert.IsNotNull(imageUI, "[AttackWarning] The object doesn't have an 'Image' component attached!"); InvokeRepeating("Blink", 0.0f, 0.3f); //effect of the warning image }
public float MaxDistance = 10.0f; //each two attack warnings must have a distance over this between each other void Awake() { //set the instance: if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(gameObject); } }