// When left mouse up private void RealeaseSelection() { SelectionBox.gameObject.SetActive(false); _selection = false; // If selection made by box if (_boxSelection) { Vector2 min = SelectionBox.anchoredPosition - (SelectionBox.sizeDelta / 2); Vector2 max = SelectionBox.anchoredPosition + (SelectionBox.sizeDelta / 2); // If there are units SelectUnits?.Invoke(min, max, _selectedUnits); _boxSelection = false; ShowUnitsInfo(); } // If selection made by left mouse click else { // Drawing Raycast to detect if there is selectable object Vector3 worldPos = _manager.GameCamera.ScreenToWorldPoint(_startPos); RaycastHit2D hit = Physics2D.Raycast(worldPos, Vector3.back, Mathf.Infinity); Debug.DrawRay(worldPos, Vector3.forward, Color.blue, 10f); // Publishing selection request to buildings SelectBuilding?.Invoke(hit, _selectedBuildings); // If there is building if (_selectedBuildings.Count > 0) { int buildingIndex = _selectedBuildings[0].BuildingIndex; BuildingData buildingData = _manager.GameConfig.Buildings[buildingIndex]; _informationMenu.ShowBuildingInfo(buildingData); } // Else if there is unit else { // Publishing selection request to units SelectUnit?.Invoke(hit, _selectedUnits); ShowUnitsInfo(); } } }
public override void Init() { base.Init(); cardAbility[TriggerTime.When][TriggerType.Play] = new List <Func <TriggerInfo, Task> >() { async(triggerInfo) => { await GameSystem.SelectSystem.SelectLocation(this); await GameSystem.TransSystem.DeployCard(TriggerInfo.Build(this, this)); } }; cardAbility[TriggerTime.When][TriggerType.Deploy] = new List <Func <TriggerInfo, Task> >() { async(triggerInfo) => { await GameSystem.SelectSystem.SelectUnite(this, cardSet[Orientation.My][RegionTypes.Battle][CardRank.Copper, CardRank.Silver][CardTag.Fairy].CardList, 1); await GameSystem.PointSystem.Cure(TriggerInfo.Build(this, SelectUnits)); if (SelectUnits.Any()) { SelectRegion = Info.RowsInfo.GetSingleRowInfoById(SelectUnits[0].location.x); SelectLocation = SelectUnits[0].location.y; } await GameSystem.TransSystem.DeployCard(TriggerInfo.Build(this, SelectUnits)); }, //async (triggerInfo) => //{ // Debug.Log("10002卡牌效果:重新部署单位"+SelectUnits.Count); // if (SelectUnits.Any()) // { // SelectRegion=Info.RowsInfo.GetSingleRowInfoById(SelectUnits[0].location.x); // SelectLocation=SelectUnits[0].location.y; // } // Debug.LogError("10002选择完毕"); // await GameSystem.TransSystem.DeployCard(TriggerInfo.Build(this,SelectUnits)); // Debug.LogError("10002部署效果触发完毕!"); //} }; }