// Create SMask public static SMask AddMask(GameObject gameObject) { SMask mask = UGUITools.AddChild <SMask>(gameObject); mask.name = "SMask"; mask.raycastTarget = true; mask.rectTransform.anchorMin = Vector2.zero; mask.rectTransform.anchorMax = Vector2.one; mask.rectTransform.sizeDelta = Vector2.zero; UGUITools.ResetGameObject(mask.gameObject); return(mask); }
void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; //target = PlayerController.instance.transform; player = transform.parent.gameObject.GetComponent <MapController>().player; target = player.gameObject.transform; max_speed_thres = player.max_horizontal_velocity / 2; } }
// Start is called before the first frame update void Start() { healthBar.Setup(healthSystem); sMask = FindObjectOfType <SMask>(); //lighting tilemap DarkMap.origin = BlurredMap.origin = Background.origin; DarkMap.size = BlurredMap.size = Background.size; foreach (Vector3Int p in DarkMap.cellBounds.allPositionsWithin) { DarkMap.SetTile(p, DarkTile); } foreach (Vector3Int p in BlurredMap.cellBounds.allPositionsWithin) { BlurredMap.SetTile(p, BlurredTile); } }