Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     if (map == null && GameObject.Find("Map"))
     {
         map = GameObject.Find("Map").GetComponent <Map_Manager>();
     }
 }
Exemplo n.º 2
0
    public void SaveMap(int stage)
    {
        GameObject[] Blocks = GameObject.FindGameObjectsWithTag("Block");
        GameObject[] Balls  = GameObject.FindGameObjectsWithTag("Ball");

        foreach (GameObject gameObj in Blocks)
        {
            Block block = new Block
            {
                type = gameObj.tag,
                x    = (int)gameObj.transform.position.x,
                y    = (int)gameObj.transform.position.y,
                z    = (int)gameObj.transform.position.z
            };
            blocks.Add(block);
        }
        foreach (GameObject gameObj in Balls)
        {
            Block ball = new Block
            {
                type = gameObj.tag,
                x    = (int)gameObj.transform.position.x,
                y    = (int)gameObj.transform.position.y,
                z    = (int)gameObj.transform.position.z
            };
            blocks.Add(ball);
        }

        string filePath = string.Format(Application.persistentDataPath + "/Maps/Stage_" + stage.ToString());

        Map_Manager.Write(blocks, filePath);
    }
Exemplo n.º 3
0
    void Awake()
    {
//		SpawnCaptains ();
        DontDestroyOnLoad(this.gameObject);
        monsterList.Clear();
        captainList.Clear();
        battleStarted = false;
        if (Application.loadedLevel == 0)
        {
            mapScript         = GameObject.FindGameObjectWithTag("Map_Manager").GetComponent <Map_Manager> ();
            startingPlayerPos = mapScript.gameObject.transform.position;
            mapPositions      = mapScript.InitGridPositionsList();
            newTurn           = true;
        }
        else if (Application.loadedLevel == 2)
        {
            survivedText = GameObject.FindGameObjectWithTag("Game Over Text").GetComponent <Text>();
            if (gameOver && !stopGame)
            {
                // display game over text
                GameOverText(numberOfTurns);
                newTurn = false;
            }
        }
    }
Exemplo n.º 4
0
    Map_Manager mapScript;     // when can just get the transform from this object anyway

    void Start()
    {
        // store the initial map manager position
        GameObject mapMan = GameObject.FindGameObjectWithTag("Map_Manager");

        mapScript  = mapMan.GetComponent <Map_Manager> ();
        townTarget = mapMan.GetComponent <Transform> ();
        target     = townTarget;
    }
    void Start()
    {
        myTransform = transform;

        myTag = gameObject.tag;

        mapScript         = GameObject.FindGameObjectWithTag("Map_Manager").GetComponent <Map_Manager> ();
        townListCount     = mapScript.townTiles.Count;
        startingListCount = townListCount;
    }
Exemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        myTransform  = transform;
        mapScript    = GetComponent <Map_Manager> ();
        townBuilding = GetComponent <TownBuilding> ();

        storedTownCount = mapScript.townTiles.Count;
        foreach (GameObject obj in mapScript.townTiles)
        {
            townTilePositions.Add(new Vector2(obj.transform.position.x, obj.transform.position.y));
        }
    }
Exemplo n.º 7
0
    void Start()
    {
        gmScript = GameObject.FindGameObjectWithTag("GM").GetComponent <GameMaster> ();
        if (Application.loadedLevel == 0)
        {
            townCentral     = GameObject.FindGameObjectWithTag("Town_Central").GetComponent <Town_Central>();
            camFollowScript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera_Follow>();
            mapScript       = GetComponent <Map_Manager>();
        }

        myTransform = transform;
        // FOR NOW im going to spawn a selection box here to be able to see what town tile i have selected
        GameObject tileSelectBox = Instantiate(selectionBox, myTransform.position, Quaternion.identity) as GameObject;

        tileSelectBox.transform.parent = myTransform;
        stopSelecting = false;
    }
Exemplo n.º 8
0
    public void Mapping_LoadMap(int stage)
    {
        string filePath = string.Format(Application.persistentDataPath + "/Maps/Stage_" + stage.ToString());

        List <Block> blocks = Map_Manager.Read(filePath);

        foreach (Block block in blocks)
        {
            if (block.type == "Block")
            {
                Instantiate(mapping_Block, new Vector3(block.x, block.y, block.z), Quaternion.identity);
            }
            else if (block.type == "Ball")
            {
                Instantiate(mapping_Ball, new Vector3(block.x, block.y, block.z), Quaternion.identity);
            }
        }
    }
Exemplo n.º 9
0
    public Mouse_Controls mouse;     // to tell it to stop selecting


    void Start()
    {
        // check if name is null to see if this is a new gatherer or if it's already on the list
        if (name == null)
        {
            name = GetName(false);
        }

        myTransform   = transform;
        town          = GameObject.FindGameObjectWithTag("Town_Central");
        townResources = town.GetComponent <TownResources> ();
        townCentral   = town.GetComponent <Town_Central> ();
        GameObject map = GameObject.FindGameObjectWithTag("Map_Manager");

        mapManager = map.GetComponent <Map_Manager> ();
        mouse      = map.GetComponent <Mouse_Controls> ();

        gathering = true;
    }
Exemplo n.º 10
0
 void Awake()
 {
     mapScript     = GetComponent <Map_Manager> ();
     mouseControls = GetComponent <Mouse_Controls> ();
     stopMouse     = mouseControls.stopSelecting;
 }
Exemplo n.º 11
0
 void Start()
 {
     dig = GameObject.FindGameObjectWithTag("Digger").GetComponent<Digger>();
     rm = GetComponent<Rooms_Manager>();
     mm = GetComponent<Map_Manager>();
     cm = GetComponent<Cleanup_Manager>();
     //StartCoroutine(StartGeneration(1f));
 }