コード例 #1
0
    // Start is called before the first frame update
    public void initialize()
    {
        if (gridMaster == null)
        {
            gridMaster = (Grid)GameObject.Find("GameMaster").GetComponent(typeof(Grid));
        }
        //unitHQ_code = (unit_HQ)GameObject.Find("unitHQ").GetComponent(typeof(unit_HQ));
        if (menuUnit == null)
        {
            menuUnit = (battleMenu)GameObject.Find("menuUnit").GetComponent(typeof(battleMenu));
        }
        if (menuStage == null)
        {
            menuStage = (stageMenu)GameObject.Find("menuStage").GetComponent(typeof(stageMenu));
        }
        if (menuCreator == null)
        {
            menuCreator = (creatorMenu)GameObject.Find("menuCreator").GetComponent(typeof(creatorMenu));
        }
        if (menuBuyGas == null)
        {
            menuBuyGas = (buygasMenu)GameObject.Find("menuBuyGas").GetComponent(typeof(buygasMenu));
        }

        /*if (p1_controls == null) {
         *  //p1_controls = (controls)GameObject.Find("controls").GetComponent(typeof(controls));
         *  p1_controls = this.gameObject.GetComponent<controls>();
         * }*/


        menuUnit.initialize();
        menuStage.initialize();
        menuCreator.initialize();
        menuBuyGas.initialize();
        menuScanResult.initialize();

        menuUnit.gameObject.SetActive(false);
        menuStage.gameObject.SetActive(false);
        menuCreator.gameObject.SetActive(false);
        menuBuyGas.gameObject.SetActive(false);
        menuScanResult.gameObject.SetActive(false);

        if (unitHQ_code != null)
        {
            unitHQ_code.initialize();
            cursorNode = unitHQ_code.thisNode;
        }
        else
        {
            cursorNode = gridMaster.nodeFromWorldPoint(transform.position);
        }
        transform.position = new Vector3(cursorNode.gridPoint.x, cursorNode.gridPoint.y, 0);

        GameObject camera = GameObject.Find("MainCamera");

        camScript = (camera)camera.GetComponent(typeof(camera));
        //camScript.alignCamera(cursorNode, false);
    }
コード例 #2
0
 // Start is called before the first frame update
 public void initialize()
 {
     //if (gridMaster == null) { gridMaster = (Grid)GameObject.Find("GameMaster").GetComponent(typeof(Grid)); }
     menuCreator = gridMaster.selector.menuCreator;
     //menuCreator.gameObject.SetActive(false);
 }