public void Initialize(TileType tileType, MapModuleBase parentModule, int layerOrder = 0) { SetLayerOrder(layerOrder); this.parentModule = parentModule; this.tileType = tileType; ChangeColor(Color.white); if (boxCollider == null) { boxCollider = gameObject.AddComponent <BoxCollider2D>(); } if (tileType == TileType.Wall) { if (boxCollider != null) { boxCollider.enabled = true; } if (spriteRenderer != null) { spriteRenderer.sortingOrder = GameConstants.WallLayerMin; } if (objectShadow != null) { objectShadow.SetObjectShadow(spriteRenderer.sprite, GameConstants.WallLayerMin - 1); } if (objectShadow != null) { objectShadow.gameObject.SetActive(true); } return; } if (tileType == TileType.Door) { ChangeColor(Color.green); OpenDoor(); } if (tileType == TileType.Normal) { if (boxCollider != null) { boxCollider.enabled = false; } } if (objectShadow != null) { objectShadow.gameObject.SetActive(false); } }
public void AddToModuleList(MapModuleBase module) { if (moduleList == null) { return; } if (module == null) { return; } moduleList.Add(module); }
public void SetPortal(bool hasPortal, MapModuleBase module) { if (portalIcon == null) { return; } if (hasPortal == true) { portalIcon.gameObject.SetActive(true); portalIcon.color = Color.red; } else if (hasPortal == false) { portalIcon.gameObject.SetActive(false); } this.hasPortal = hasPortal; this.linkModule = module; }
public MiniMap_MapIcon MakeRoomIcon(Vector3 position, Vector3 scale, bool hasPortal = false, MapModuleBase linkModule = null) { GameObject obj = Instantiate(mapIconPrefab, iconsParent); if (obj != null) { obj.transform.localPosition = position; obj.transform.localScale = scale; MiniMap_MapIcon icon = obj.GetComponent <MiniMap_MapIcon>(); icon.SetPortal(hasPortal, linkModule); objectList.Add(icon.gameObject); return(icon); } return(null); }
public void Initialize(MapModuleBase parentModule) { this.parentModule = parentModule; this.transform.parent = parentModule.transform; this.transform.localPosition = Vector3.zero; }