コード例 #1
0
 // Use this for initialization
 void Start()
 {
     hexGrid         = GetComponent <HexGrid>();
     turnScript      = GetComponent <TurnScript>();
     generatorScript = GetComponent <GeneratorScript>();
     selected        = noSelection;
 }
コード例 #2
0
ファイル: GeneratorScript.cs プロジェクト: rrliu/fireline
    public void LoadGame(int level)
    {
        TileType[,] tileTypes;
        #if UNITY_EDITOR
        if (cache && File.Exists(CACHE_PATH))
        {
            tileTypes = LoadTilesEditor();
            Debug.Log("Loaded tile info from cache");
        }
        else
        {
            tileTypes = GenerateTiles();
            Debug.Log("Generated tile info");
        }
        CacheTilesEditor(tileTypes);
        #else
        tileTypes = LoadTilesRelease();
        #endif

        HexGrid hexGrid = gameObject.GetComponent <HexGrid>();
        hexGrid.GenerateGrid(tileTypes, level);
        mainMenu.SetActive(false);
        menuMusic.Stop();
        gameMusic.Play();

        int     pixWidth        = rivers.texture.width;
        int     pixHeight       = rivers.texture.height;
        Vector3 backgroundScale = new Vector3(
            1.0f / (2.0f * radius),
            1.0f / (2.0f * radius),
            1.0f
            );
        Vector3 backgroundPos = new Vector3(
            -start.x * backgroundScale.x,
            -start.y * backgroundScale.y,
            0.0f
            );
        backgroundPos.x += pixWidth * backgroundScale.x / 2.0f;
        backgroundPos.y += pixHeight * backgroundScale.y / 2.0f;
        background.transform.position   = backgroundPos;
        background.transform.localScale = backgroundScale;
        background.SetActive(true);

        TurnScript turnScript = gameObject.GetComponent <TurnScript>();
        StartCoroutine(turnScript.PlaceCamps(level));
        if (level == 1)
        {
            turnScript.money = 500 * level;
        }
        else if (level == 2)
        {
            turnScript.money = 500 * level;
        }
        else if (level == 3)
        {
            turnScript.money = 2000;
        }

        loaded = true;
    }
コード例 #3
0
ファイル: GlobalScript.cs プロジェクト: Izzu/Hearthstone-RTS
    // Use this for initialization
    void Start()
    {
        ourGlobalScript = this;

        ourUnitScripts = Object.FindObjectsOfType <UnitScript>();

        ourPlayerScripts = Object.FindObjectsOfType <PlayerScript>();

        ourCursorScript = Object.FindObjectOfType <CursorScript>();

        ourTurnScript = Object.FindObjectOfType <TurnScript>();

        ourPhaseScript = Object.FindObjectOfType <PhaseScript>();
    }
コード例 #4
0
ファイル: GlobalScript.cs プロジェクト: Izzu/Hearthstone-RTS
    // Use this for initialization
    void Start()
    {
        ourGlobalScript = this;

        ourUnitScripts = Object.FindObjectsOfType<UnitScript>();

        ourPlayerScripts = Object.FindObjectsOfType<PlayerScript>();

        ourCursorScript = Object.FindObjectOfType<CursorScript>();

        ourTurnScript = Object.FindObjectOfType<TurnScript>();

        ourPhaseScript = Object.FindObjectOfType<PhaseScript>();
    }
コード例 #5
0
 private void Awake()
 {
     turnScript          = GetComponent <TurnScript>();
     turnScript.turnTime = true;
 }
コード例 #6
0
ファイル: HexGrid.cs プロジェクト: rrliu/fireline
 // Use this for initialization
 void Start()
 {
     turnScript = GetComponent <TurnScript>();
 }