void placeUnit(WorldPosition mouseWP, Vector3 mouseVect) //VIEW BASED APPROACH { foreach (GameObject zoneObj in mapView.zonesDict.Keys) //currently non in here { Debug.Log(zoneObj); ZoneView zoneView = zoneObj.GetComponent <ZoneView> (); if (zoneView._zoneModel._party == currentParty) { foreach (GameObject zoneFragObj in mapView.zonesDict[zoneObj]) { ZzfragView zzFrag = zoneFragObj.GetComponent <ZzfragView> (); if (overLapszZ(zzFrag, mouseVect)) { UnitPrep unitPrep = _unitPrepManager.SpawnUnitPrep(currentUnit.Id, zoneView._zoneModel._alliance, mouseWP); StaticAllData.currentMap._formationUnits.Add(unitPrep); Debug.Log("unit placed attempt : " + currentUnit.Name + " " + mouseWP.ToString()); pickedUpUnit = false; break; } else { Debug.Log("didn't overlap with this zzfrag"); } } } } }
void CreateZone(Vector3 pos) { ZoneView aZone = _zoneFactory.Create(); aZone.SetCenterPosition(pos); _zones.Add(aZone); }
public override void Enter() { _targetSystem = InputSystem.Game.GetSystem <TargetSystem>(); _targetAttribute = InputSystem.ActiveCard.Card.GetAttribute <ManualTarget>(); _targets = new List <CardView>(); _targetAttribute.Selected = new List <Card>(); var candidates = _targetSystem.GetTargetCandidates(InputSystem.ActiveCard.Card, _targetAttribute.Allowed); _candidateViews = InputSystem.GameView.FindCardViews(candidates); InputSystem.ActiveCard.Highlight(_targetAttribute.RequiredAmount == 0 ? Colors.HasTargets : Colors.NeedsTargets); _candidateViews.Highlight(Colors.IsTargetCandidate); if (_targetAttribute.Allowed.Zones.HasZone(Zones.Deck | Zones.Discard | Zones.Hand)) { // NOTE: We only expect one of the above zones to be targetable at once, bad assumption? var player = _candidateViews.Select(c => c.Card.Owner).Distinct().Single(); var zoneToPreview = _candidateViews.Select(c => c.Card.Zone).Distinct().Single(); if (player.Index != MatchData.LOCAL_PLAYER_INDEX || zoneToPreview != Zones.Hand) { var zoneView = InputSystem.GameView.FindZoneView(player, zoneToPreview); zoneView.GetPreviewSequence(sortOrder: PreviewSortOrder.ByType); _zoneInPreview = zoneView; } } }
public async Task Update(ZoneView entity) { try { var vList = adbContext.zone.Where(x => x.Zone_Id == entity.Zone_Id).FirstOrDefault(); if (vList != null) { vList.Company_Id = entity.Company_Id; vList.Zone_Code = entity.Zone_Code; vList.Zone_Name = entity.Zone_Name; vList.isActive = entity.isActive; vList.UpdatedBy = entity.UpdatedBy; vList.UpdatedOn = DateTime.Now; adbContext.zone.Update(vList); await Task.FromResult(adbContext.SaveChanges()); } else { throw new Exception("Data Not Available"); } } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> Edit(ZoneView zone) { if (!ModelState.IsValid) { objHelper.Status = StatusCodes.Status424FailedDependency; objHelper.Message = "Invalid Model State"; return(BadRequest(objHelper)); } try { if (zoneRepository.Exists(zone)) { objHelper.Status = StatusCodes.Status200OK; objHelper.Message = "Data already available"; return(Ok(objHelper)); } await zoneRepository.Update(zone); objHelper.Status = StatusCodes.Status200OK; objHelper.Message = "Saved Successfully"; return(Ok(objHelper)); } catch { objHelper.Status = StatusCodes.Status500InternalServerError; objHelper.Message = "Save Unsuccessful"; return(StatusCode(StatusCodes.Status500InternalServerError, objHelper)); } }
public void OnInitializePotentialDrag(PointerEventData eventData) { Contract.Requires(eventData != null); ZoneView newZone = _zoneCreator.CreateZone(eventData.pointerCurrentRaycast.worldPosition); eventData.pointerDrag = newZone.gameObject; }
public override void Enter() { var cardView = InputSystem.ActiveCard; var cardType = cardView.Card.Data.Type; var previewRotation = ZoneView.GetRotation(isFaceDown: false, isHorizontal: cardType.IsHorizontal(), isEnemy: false); cardView.Move(CardPreviewPosition, previewRotation); }
public ZoneView CreateZone(Vector3 pos) { ZoneView aZone = _zoneFactory.Create(); pos.z = 0; aZone.SetCenterPosition(pos); return(aZone); }
public void Configure(Values values) { HealingSpeed = values.Get("HpPerSec", 0f); HealthPool = values.Get("HpPool", 0f); ZonePrefab = values.GetPrefabWithComponent <ZoneView>("Visual", fixName: false); var sizes = values.Get("HitBox", "1x1").Split('x'); var x = float.Parse(sizes[0]); var z = float.Parse(sizes[1]); Size = new Vector3(x, 1, z); }
public override void Exit() { _targets = null; _candidateViews = null; _targetAttribute = null; _targetSystem = null; if (_zoneInPreview != null) { _zoneInPreview.GetZoneLayoutSequence(); _zoneInPreview = null; } }
public void Initialize() { _view = Instantiate(_zoneInfo.ZonePrefab, transform.position, transform.rotation) as ZoneView; _view.transform.localScale = _zoneInfo.Size; _view.CharacterEntered += OnCharacterEnter; _view.CharacterExited += OnCharacterExit; _healingAmount = _zoneInfo.HealthPool; _isAutoDrainStarted = false; IsDrained = false; }
public bool Exists(ZoneView entity) { int intCount = 0; if (entity.Zone_Id > 0) //Update Validation { intCount = adbContext.zone.Where(w => w.Company_Id == entity.Company_Id && w.Zone_Id != entity.Zone_Id && (w.Zone_Code == entity.Zone_Code && w.Zone_Name == entity.Zone_Name)).Count(); } else //Insert Validation { intCount = adbContext.zone.Where(w => w.Company_Id == entity.Company_Id && (w.Zone_Code == entity.Zone_Code && w.Zone_Name == entity.Zone_Name)).Count(); } return(intCount > 0 ? true : false); }
private void CancelTargeting() { _targets.Clear(); InputSystem.ActiveCard.Highlight(Color.clear); _candidateViews.Highlight(Color.clear); if (_zoneInPreview != null) { _zoneInPreview.GetZoneLayoutSequence(); _zoneInPreview = null; } InputSystem.StateMachine.ChangeState <ResetState>(); }
protected override void OnDragDropRelease(GameObject surface) { if (surface != null) { if (surface.GetComponent <ZoneView>() == null) { surface = null; } else { Zone possibleZone = surface.GetComponent <ZoneView>().zoneModel; if (possibleZone && !possibleZone.queueOpen) //if (!surface.GetComponent<Zone>().queueOpen) //If queue is full, send the customer object back. { surface = null; } } //else if (possibleZone) //{ // possibleZone.zoneViews[0].OnDrop(gameObject); // return; //} } base.OnDragDropRelease(surface); dragging = false; customerView.EndDrag(); RaycastHit[] hits = RaycastForZones(); if (hits.Length > 0) { foreach (RaycastHit hit in hits) { if (hit.collider.name == "Fader" || hit.collider.name == "Zoner") { return; } } ZoneView possibleZoneView = hits[0].collider.GetComponent <ZoneView>(); possibleZoneView.OnCustomDrop(gameObject); } else { AudioManager.instance.CustomerReleased(); } }
public ZoneController(GameObject parent, Vector3 pos, int width, int height) { this.pos = pos; var go = (GameObject)GameObject.Instantiate (Resources.Load ("Zone")); view = go.GetComponent<ZoneView> (); view.RecountTiles (width, height); Vector3 tempPos = GameController.instance.grid.GetTileByPos(pos).center; corner = new Vector3 (tempPos.x - Mathf.Sign (width) * Grid.tileSize / 2f, tempPos.y + 0.1f, tempPos.z - Mathf.Sign (height) * Grid.tileSize / 2f); go.transform.parent = parent.transform; go.transform.localPosition = corner; go.transform.localScale = new Vector3 (0.1f * width, 0.01f, 0.1f * height); go.transform.localRotation = Quaternion.identity; }
protected override void OnDragDropMove(Vector3 delta) { //Fades zones in when dragging customer. base.OnDragDropMove(delta); RaycastHit[] hits = RaycastForZones(); foreach (RaycastHit hit in hits) { if (hit.collider.name == "Fader") { return; } if (hit.collider.name == "Zoner") { God.instance.FadeZones(true); return; } } foreach (RaycastHit hit in hits) { ZoneView view = hit.collider.GetComponent <ZoneView>(); view.zoneModel.zoneViews.ForEach(zonView => { zonView.GetComponent <UIPlayAnimation>().Play(true); }); foreach (Zone zone in God.instance.zones) { if (zone != view.zoneModel) { zone.zoneViews.ForEach(zonView => { zonView.GetComponent <UIPlayAnimation>().Play(false); }); } } } }
public async Task Insert(ZoneView entity) { try { //Insert New Zone var vList = new Zone { Zone_Id = entity.Zone_Id, Zone_Name = entity.Zone_Name, Zone_Code = entity.Zone_Code, Company_Id = entity.Company_Id, isActive = entity.isActive, AddedBy = entity.AddedBy, AddedOn = DateTime.Now }; adbContext.zone.Add(vList); await Task.FromResult(adbContext.SaveChanges()); } catch (Exception ex) { throw ex; } }