//used to teleport from player zone public void ShowSelection(bool cond, int maxTroops, ExitZone zone) { if (_confirmButton == null || _cancelButton == null || _AssignmentModeButton == null) { Debug.LogError("One of The Objects in UI Troop Selection is null"); return; } _zone = zone; _numTroopsMax = maxTroops; this.gameObject.SetActive(cond); //set the text setText("Dispatch Garrison Troops"); _confirmButton.SetActive(cond); _cancelButton.SetActive(cond); _AssignmentModeButton.SetActive(!cond); MVCController.Instance.TurnOffBuildMenus(); UIAssignmentMenu.Instance.ShowOutpostWorkers(cond); //order matters here if (cond) { UIAssignmentMenu.Instance.ShowArrowButtons(cond); _cameraController.setOverrideMode(cond); } else { _cameraController.setOverrideMode(cond); UIAssignmentMenu.Instance.ShowArrowButtons(cond); } updateText(); }
//used to teleport back from neutral/enemy zone public void ShowSelection(bool cond, ExitZone zone) { if (_confirmButton == null || _cancelButton == null || _AssignmentModeButton == null) { Debug.LogError("One of The Objects in UI Troop Selection is null"); return; } _zone = zone; _confirmButton.SetActive(cond); _cancelButton.SetActive(cond); this.gameObject.SetActive(cond); _amounts.text = ""; setText("Leave Zone?"); }
// Start is called before the first frame update void Start() { _parent = this.transform.parent.GetComponent <ExitZone>(); _cameraController = Camera.main.GetComponent <CameraController>(); if (_destinationObject) { _teleportX = _destinationObject.transform.position.x; } else { _teleportX = 0; Debug.Log("teleportDestination for teleporter script not assigned properly"); } }
// Use this for initialization public override void Initialize(Action <SystemBase> OnInitialized = null) { if (!APP.IsReady) // checking whether APP is active or not { APP.WaitForSubsystem(APP.PlayerTankManager, Start); return; } if (APP.PlayerTankManager.isArcade) // checking if current game mode is arcade mode { if (APP.PlayerTankManager._ArcadeMode == arcadeMode.defend || APP.PlayerTankManager._ArcadeMode == arcadeMode.SearchAndDestroy) { defendModeSettings = FindObjectOfType <ExitZone>(); } } levelManagerRef = FindObjectOfType <LevelManager>(); myCanvas = GetComponent <Canvas>(); myCanvas.enabled = false; Time.timeScale = 1; if (loadingOverlay) { loadingOverlay.SetActive(false); } if (restartMissionPrompt) { restartMissionPrompt.SetActive(false); } if (leaveMissionPrompt) { leaveMissionPrompt.SetActive(false); } gameWon = false; IsInitialized = true; if (OnInitialized != null) { OnInitialized.Invoke(this); } }
public void setExitZone(int zone, bool isRight, ExitZone ez) { /* * if (s.Equals("playerzone")) * _PlayerZone = ez; * else if (s.Equals("neutralzone")) * _NeutralZone = ez; * else if (s.Equals("enemyzone")) * _NeutralZone = ez; */ if (zone == 1) { _PlayerZone = ez; } if (zone == 0) { _NeutralZone = ez; } if (zone == 2) { _EnemyZone = ez; } }
IEnumerator DeathDelay() { //Fun Way to use event system //EventSystem.Instance.IDied(this); //but this was already here and much cleaner/easier..lmao, oh well i learned alot if (_Job) { _Job.Dismiss(this); //Unassign self from job } //If teleported, have to find an un-assign self from outpost GameObject TeleportDummy = GameObject.FindGameObjectWithTag("TeleportedRodents"); if (TeleportDummy && this.transform.parent.gameObject == TeleportDummy) { ExitZone zone = GameManager.Instance.getPlayerZone(); if (zone) { BuildableObject garrison = zone.getRodentOutpost(this); if (garrison) { garrison.DismissWorker(this); } zone.RemoveDeadRodent(this); } } //Chance to Spawn Shiny if (_Team == 2) { if (_Type == eRodentType.EKing) { //drop crown GameObject crown = Resources.Load <GameObject>("ResourceIcons/Collectable_Crown"); if (crown) { crown = GameObject.Instantiate(crown, this.transform.position, this.transform.rotation); var c = crown.GetComponent <CoinResource>(); if (c) { var eKing = this.GetComponent <EKing>(); if (eKing) { c.setKingdomSide(eKing.getCrownSide()); } } } } else //drop shiny { int roll = Random.Range(0, 10); if (roll == 1) { GameObject pickup = Resources.Load <GameObject>("ResourceIcons/Collectable_Resource"); if (pickup) { GameObject ppp = GameObject.Instantiate(pickup, this.transform.position, this.transform.rotation); ppp.GetComponent <CoinResource>().setResourceType(ResourceManagerScript.ResourceType.Shiny); } } } } if (_NotifyAnimator) { Destroy(_NotifyAnimator.gameObject); } yield return(new WaitForSeconds(5f)); Destroy(this.gameObject); }
private void EvaluateEntityState(Entity entity) { var state = _entityStates[entity]; // Check if entity has moved if (entity.Position != state.Position) { var isZone = IsPositionZone(entity.Position, out var zone); //EntityMoved?.Invoke(this, new Entity.EntityMovedEventArgs(entity, state.Position)); if (!state.IsDisabled) { // Still in zone if (state.IsInZone && isZone) { // Same zone -- trigger move event if (state.Zone == zone) { OnEntityMoveZone(_screen, zone, entity, entity.Position, state.Position); //MoveZone?.Invoke(this, new ZoneMoveEventArgs(_screen, zone, entity, entity.Position, state.Position)); } // New zone -- trigger exit and enter event. else { OnEntityExitZone(_screen, state.Zone, entity, entity.Position); OnEntityEnterZone(_screen, zone, entity, entity.Position); ExitZone?.Invoke(this, new ZoneEventArgs(_screen, state.Zone, entity, state.Position)); EnterZone?.Invoke(this, new ZoneEventArgs(_screen, zone, entity, entity.Position)); state.Zone = zone; } } // Left zone else if (state.IsInZone) { OnEntityExitZone(_screen, state.Zone, entity, entity.Position); ExitZone?.Invoke(this, new ZoneEventArgs(_screen, state.Zone, entity, state.Position)); state.IsInZone = false; state.Zone = null; } // Entered zone else if (isZone) { OnEntityEnterZone(_screen, zone, entity, entity.Position); EnterZone?.Invoke(this, new ZoneEventArgs(_screen, zone, entity, entity.Position)); state.IsInZone = true; state.Zone = zone; } //// Still in hotspot //if (state.IsInHotspot && isHotspot) //{ // OnEntityExitHotspot(_screen, state.Hotspot, entity, state.Position); // OnEntityEnterHotspot(_screen, spot, entity, entity.Position); // ExitHotspot?.Invoke(this, new HotspotEventArgs(_screen, state.Hotspot, entity, state.Position)); // EnterHotspot?.Invoke(this, new HotspotEventArgs(_screen, spot, entity, entity.Position)); // state.Hotspot = spot; //} //// Left hotspot //else if (state.IsInHotspot) //{ // OnEntityExitHotspot(_screen, state.Hotspot, entity, state.Position); // ExitHotspot?.Invoke(this, new HotspotEventArgs(_screen, state.Hotspot, entity, state.Position)); // state.IsInHotspot = false; // state.Hotspot = null; //} //else if (isHotspot) //{ // OnEntityEnterHotspot(_screen, spot, entity, entity.Position); // EnterHotspot?.Invoke(this, new HotspotEventArgs(_screen, spot, entity, entity.Position)); // state.IsInHotspot = true; // state.Hotspot = spot; //} } RemoveEntityPositionCollection(entity, state.Position); state.Position = entity.Position; UpdateEntityPositionCollection(entity); } }