Exemplo n.º 1
0
        /// <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>();
 }
Exemplo n.º 3
0
 void Start()
 {
     if (canvas == null)
     {
         try {
             canvas = WorldCanvas.GetInstance().transform;
         } catch {
             //this scene doesnt need a canvas refernce
         }
     }
 }
Exemplo n.º 4
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 5
0
    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();
    }
Exemplo n.º 6
0
    // ***************************************************************************

    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();
    }
Exemplo n.º 7
0
    private void OnDestroy()
    {
        GameManager.instance = null;

        if (worldCanvasInstance != null)
        {
            this.SafeDestroy(worldCanvasInstance);
            worldCanvasInstance = null;
        }

        if (personGeneratorInstance != null)
        {
            this.SafeDestroy(personGeneratorInstance);
            personGeneratorInstance = null;
        }
    }
Exemplo n.º 8
0
        /// <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);
            }
        }
Exemplo n.º 9
0
    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);
    }
Exemplo n.º 10
0
        /// <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);
            }
        }
Exemplo n.º 11
0
 private void Awake()
 {
     instance = this;
 }
Exemplo n.º 12
0
 void Awake()
 {
     _instance = this;
 }
Exemplo n.º 13
0
 protected void OnDestroy()
 {
     _instance = null;
 }