/// <summary> /// Represents a form containing an editable world /// </summary> /// <param name="settings"> World settings </param> public FormWorld(WorldSettings settings, Form parent) { InitializeComponent(); MdiParent = parent; history = new WorldHistory(); this.settings = settings; userProperties = new Dictionary <string, string>(); InitWorld(); scrollBarHorizontal.Scroll += scrollBarScroll; scrollBarVertical.Scroll += scrollBarScroll; worldCanvas = new WorldCanvas(this) { ContextMenuStrip = settingsMenu }; canvasPanel.Controls.Add(worldCanvas); worldCanvas.Dock = DockStyle.Fill; }
// Start is called before the first frame update void Start() { forgeInfo = "Pick a part and a material"; defaultColour = infoText.color; resultFunc = Result.GetComponent <ItemFunction>(); WorldCanvas = GameObject.Find("Canvas"); mainCurrency = WorldCanvas.GetComponent <Currency>(); }
void Start() { if (canvas == null) { try { canvas = WorldCanvas.GetInstance().transform; } catch { //this scene doesnt need a canvas refernce } } }
void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } }
public void InitalizeStage() { DisplayMap.CompressBounds(); Bounds bounds = Instance.DisplayMap.localBounds; stageBounds = bounds; InputManager.Instance.SetCameraBounds(); WorldCanvas.GetComponent <Canvas>().worldCamera = Camera.main; HighlightMap.gameObject.SetActive(false); BattleManager.Initialize(); }
// *************************************************************************** private void Awake() { if (GameManager.instance != null) { Debug.LogError("Multiple instances of GameManager! Destroying duplicate."); this.SafeDestroy(this.gameObject); return; } GameManager.instance = this; worldCanvasInstance = GameObject.Instantiate <WorldCanvas>(worldCanvasPrefab); personGeneratorInstance = GameObject.Instantiate <PersonGenerator>(personGeneratorPrefab); ResetVariables(); }
private void OnDestroy() { GameManager.instance = null; if (worldCanvasInstance != null) { this.SafeDestroy(worldCanvasInstance); worldCanvasInstance = null; } if (personGeneratorInstance != null) { this.SafeDestroy(personGeneratorInstance); personGeneratorInstance = null; } }
/// <inheritdoc/> public override void Update(UpdateMode updateMode) { // use bitmap rendering vor levels < 10 if (MapView.FinalZoom < 10) { if (vectorCanvas != null) { Children.Remove(vectorCanvas); vectorCanvas = null; } if (bitmapCanvas == null) { bitmapCanvas = new UntiledCanvas(MapView, new MyOverlayRenderer { SymbolColor = SymbolColor, SymbolSize = SymbolSize, Locations = Locations }, false); Children.Add(bitmapCanvas); } bitmapCanvas.Update(updateMode); } else { if (bitmapCanvas != null) { Children.Remove(bitmapCanvas); bitmapCanvas = null; } if (vectorCanvas == null) { vectorCanvas = new MyDeepZoomCanvas(MapView) { SymbolColor = SymbolColor, SymbolSize = SymbolSize, Locations = Locations }; Children.Add(vectorCanvas); } vectorCanvas.Update(updateMode); } }
public bool TakeDamage(float damage, string fromWhat = "") { int intDam = Mathf.RoundToInt(damage); if (intDam < 1) { return(false); } UnityEngine.UI.Text floater = GameObject.Instantiate(eventFloaterPrefab) as UnityEngine.UI.Text; floater.text = "-" + intDam; floater.color = color; WorldCanvas.Position(floater.rectTransform, transform.position); health -= intDam; if (health <= 0) { Die(fromWhat); } return(true); }
/// <inheritdoc/> public override void Update(UpdateMode updateMode) { // use bitmap rendering vor levels < 10 if (MapView.FinalZoom < 10) { if (vectorCanvas != null) { this.Children.Remove(vectorCanvas); vectorCanvas = null; } if (bitmapCanvas == null) { bitmapCanvas = new UntiledCanvas(MapView, new MyOverlayRenderer() { SymbolColor = this.SymbolColor, SymbolSize = this.SymbolSize, Locations = this.Locations }, false); this.Children.Add(bitmapCanvas); } bitmapCanvas.Update(updateMode); } else { if (bitmapCanvas != null) { this.Children.Remove(bitmapCanvas); bitmapCanvas = null; } if (vectorCanvas == null) { vectorCanvas = new MyDeepZoomCanvas(MapView) { SymbolColor = this.SymbolColor, SymbolSize = this.SymbolSize, Locations = this.Locations }; this.Children.Add(vectorCanvas); } vectorCanvas.Update(updateMode); } }
private void Awake() { instance = this; }
void Awake() { _instance = this; }
protected void OnDestroy() { _instance = null; }