public static bool IsLaserFromEnemy(this LaserOrigin laserOrigin) { return(laserOrigin.Equals(LaserOrigin.Enemy)); }
public void LoadLevel(string levelName) { TextAsset loadedLevel = Resources.Load <TextAsset>("Map Datas/" + levelName); MapDataHolder mapDataHolder = JsonUtility.FromJson <MapDataHolder>(loadedLevel.text); foreach (var inSceneObjData in mapDataHolder.inSceneObjectDatas) { switch (inSceneObjData.inSceneObjectType) { case IN_SCENE_OBJECT_TYPES.NORMAL_HORIZONTAL_LINE: case IN_SCENE_OBJECT_TYPES.NORMAL_VERTICAL_LINE: transformBorders.GetChild(inSceneObjData.mapGridIndex).GetComponent <MapGridGameplay>().ToggleBorder(LASER_COLOR.DEFAULT, inSceneObjData.borderDir, true); break; case IN_SCENE_OBJECT_TYPES.WHITE_HORIZONTAL_LINE: case IN_SCENE_OBJECT_TYPES.WHITE_VERTICAL_LINE: transformBorders.GetChild(inSceneObjData.mapGridIndex).GetComponent <MapGridGameplay>().ToggleBorder(LASER_COLOR.WHITE, inSceneObjData.borderDir, true); break; case IN_SCENE_OBJECT_TYPES.RED_HORIZONTAL_LINE: case IN_SCENE_OBJECT_TYPES.RED_VERTICAL_LINE: transformBorders.GetChild(inSceneObjData.mapGridIndex).GetComponent <MapGridGameplay>().ToggleBorder(LASER_COLOR.RED, inSceneObjData.borderDir, true); break; case IN_SCENE_OBJECT_TYPES.YELLOW_HORIZONTAL_LINE: case IN_SCENE_OBJECT_TYPES.YELLOW_VERTICAL_LINE: transformBorders.GetChild(inSceneObjData.mapGridIndex).GetComponent <MapGridGameplay>().ToggleBorder(LASER_COLOR.YELLOW, inSceneObjData.borderDir, true); break; case IN_SCENE_OBJECT_TYPES.BLUE_HORIZONTAL_LINE: case IN_SCENE_OBJECT_TYPES.BLUE_VERTICAL_LINE: transformBorders.GetChild(inSceneObjData.mapGridIndex).GetComponent <MapGridGameplay>().ToggleBorder(LASER_COLOR.BLUE, inSceneObjData.borderDir, true); break; case IN_SCENE_OBJECT_TYPES.ORIGIN_POINT_WHITE: LaserOrigin originPointWhite = Instantiate(originPointPrefab, transformBorders.GetChild(inSceneObjData.mapGridIndex).transform.position, inSceneObjData.rotation, transformBorders.GetChild(inSceneObjData.mapGridIndex).transform); transformGrids.GetChild(inSceneObjData.mapGridIndex).gameObject.SetActive(false); originPointWhite.LaserColor = LASER_COLOR.WHITE; originPointWhite.Initialization(); break; case IN_SCENE_OBJECT_TYPES.ORIGIN_POINT_RED: LaserOrigin originPointRed = Instantiate(originPointPrefab, transformBorders.GetChild(inSceneObjData.mapGridIndex).transform.position, inSceneObjData.rotation, transformBorders.GetChild(inSceneObjData.mapGridIndex).transform); transformGrids.GetChild(inSceneObjData.mapGridIndex).gameObject.SetActive(false); originPointRed.LaserColor = LASER_COLOR.RED; originPointRed.Initialization(); break; case IN_SCENE_OBJECT_TYPES.ORIGIN_POINT_YELLOW: LaserOrigin originPointYellow = Instantiate(originPointPrefab, transformBorders.GetChild(inSceneObjData.mapGridIndex).transform.position, inSceneObjData.rotation, transformBorders.GetChild(inSceneObjData.mapGridIndex).transform); transformGrids.GetChild(inSceneObjData.mapGridIndex).gameObject.SetActive(false); originPointYellow.LaserColor = LASER_COLOR.YELLOW; originPointYellow.Initialization(); break; case IN_SCENE_OBJECT_TYPES.ORIGIN_POINT_BLUE: LaserOrigin originPointBlue = Instantiate(originPointPrefab, transformBorders.GetChild(inSceneObjData.mapGridIndex).transform.position, inSceneObjData.rotation, transformBorders.GetChild(inSceneObjData.mapGridIndex).transform); transformGrids.GetChild(inSceneObjData.mapGridIndex).gameObject.SetActive(false); originPointBlue.LaserColor = LASER_COLOR.BLUE; originPointBlue.Initialization(); break; case IN_SCENE_OBJECT_TYPES.DESTINATION_POINT_WHITE: LaserDestination endPointWhite = Instantiate(endPointPrefab, transformBorders.GetChild(inSceneObjData.mapGridIndex).transform.position, inSceneObjData.rotation, transformBorders.GetChild(inSceneObjData.mapGridIndex).transform); transformGrids.GetChild(inSceneObjData.mapGridIndex).gameObject.SetActive(false); endPointWhite.LaserColor = LASER_COLOR.WHITE; endPointWhite.Initialization(); break; case IN_SCENE_OBJECT_TYPES.DESTINATION_POINT_RED: LaserDestination endPointRed = Instantiate(endPointPrefab, transformBorders.GetChild(inSceneObjData.mapGridIndex).transform.position, inSceneObjData.rotation, transformBorders.GetChild(inSceneObjData.mapGridIndex).transform); transformGrids.GetChild(inSceneObjData.mapGridIndex).gameObject.SetActive(false); endPointRed.LaserColor = LASER_COLOR.RED; endPointRed.Initialization(); break; case IN_SCENE_OBJECT_TYPES.DESTINATION_POINT_YELLOW: LaserDestination endPointYellow = Instantiate(endPointPrefab, transformBorders.GetChild(inSceneObjData.mapGridIndex).transform.position, inSceneObjData.rotation, transformBorders.GetChild(inSceneObjData.mapGridIndex).transform); transformGrids.GetChild(inSceneObjData.mapGridIndex).gameObject.SetActive(false); endPointYellow.LaserColor = LASER_COLOR.YELLOW; endPointYellow.Initialization(); break; case IN_SCENE_OBJECT_TYPES.DESTINATION_POINT_BLUE: LaserDestination endPointBlue = Instantiate(endPointPrefab, transformBorders.GetChild(inSceneObjData.mapGridIndex).transform.position, inSceneObjData.rotation, transformBorders.GetChild(inSceneObjData.mapGridIndex).transform); transformGrids.GetChild(inSceneObjData.mapGridIndex).gameObject.SetActive(false); endPointBlue.LaserColor = LASER_COLOR.BLUE; endPointBlue.Initialization(); break; case IN_SCENE_OBJECT_TYPES.PORTAL_1ST_SET_HORIZONTAL: case IN_SCENE_OBJECT_TYPES.PORTAL_1ST_SET_VERTICAL: Teleporter teleporter1stSet = Instantiate(teleporterSetAPrefab, transformBorders.GetChild(inSceneObjData.mapGridIndex).GetComponent <MapGridGameplay>().GetBorderTransform(inSceneObjData.borderDir)); teleporter1stSet.SetRotation(inSceneObjData.borderDir); break; case IN_SCENE_OBJECT_TYPES.PORTAL_2ND_SET_HORIZONTAL: case IN_SCENE_OBJECT_TYPES.PORTAL_2ND_SET_VERTICAL: Teleporter teleporter2ndSet = Instantiate(teleporterSetBPrefab, transformBorders.GetChild(inSceneObjData.mapGridIndex).GetComponent <MapGridGameplay>().GetBorderTransform(inSceneObjData.borderDir)); teleporter2ndSet.SetRotation(inSceneObjData.borderDir); break; } } GameManager.Instance.Initialization(mapDataHolder); }
public static bool IsLaserFromPlayer(this LaserOrigin laserOrigin) { return(laserOrigin.Equals(LaserOrigin.Player)); }