Example #1
0
    int[,] isAvailable;//0>Nothing 1>Straight 2> side 3>upleft 4>upright 5>leftup 6>rightup 7>tower 8>Barricade 9>Don't use

    public void SetValuesAndGenerate(ScriptableRankProperties props)
    {
        mapSize              = props.mapSize;
        turn                 = props.turns;
        arrowTowerCount      = props.numOfArrowTowers;
        bombTowerCount       = props.numOfBombTowers;
        groundBarricadeCount = props.numOfGroundBarricade;
        blockBarricadeCount  = props.numOfBlockBarricade;
        percentIncrement     = 80 / (turn / 2);
        Generate();
    }
    public static void CreateMyRank()
    {
        ScriptableRankProperties asset = ScriptableObject.CreateInstance <ScriptableRankProperties>();

        AssetDatabase.CreateAsset(asset, "Assets/Data/Ranks/NewRankProps.asset");
        AssetDatabase.SaveAssets();

        EditorUtility.FocusProjectWindow();

        Selection.activeObject = asset;
    }
    void Start()
    {
        Time.timeScale = 1;
        //1. Loading should appear
        //2. Get value from StatisticsManager
        //3. Set the values for Path
        //4. Give the  values to PathGenerator Class
        //5. Activate the interface before battle
        //5. End

        //Instantiate MyMap
        myGeneratedMap = Instantiate(myMap, Vector3.zero, Quaternion.identity) as Transform;
        myGeneratedMap.gameObject.name = "MyMap";

        //Create OffenseHeadquaters
        Transform OHQ = Instantiate(OffenseHQ, transform.position, Quaternion.identity) as Transform;

        OHQ.name = "OffenseHeadQuaters";

        BeforeBattle(false);
        InBattle(false);
        rank                       = StatisticsManager.SM.GetDetails("Player_Rank");
        currentRankProps           = rankProps[rank - 1];
        generator                  = myGeneratedMap.gameObject.GetComponent <PathGenerator>();
        generator.OnPercentChange += UpdatePercentValue;
        generator.SetValuesAndGenerate(currentRankProps);
        spawnPosition = generator.spawnPointPosition;
        gateBroken    = false;

        //Get referece to all Windows
        resultPanel = GameResultPanel.Instance();
        pausePanel  = PausePanel.Instance();

        //Set Up all Actions
        SetAllActions();
    }
    void Start()
    {
        Time.timeScale = 1;
        //1. Loading should appear
        //2. Get value from StatisticsManager
        //3. Set the values for Path
        //4. Give the  values to PathGenerator Class
        //5. Activate the interface before battle
        //5. End

        //Instantiate MyMap
        myGeneratedMap = Instantiate(myMap, Vector3.zero, Quaternion.identity) as Transform;
        myGeneratedMap.gameObject.name = "MyMap";

        //Create OffenseHeadquaters
        Transform OHQ = Instantiate(OffenseHQ, transform.position, Quaternion.identity) as Transform;
        OHQ.name = "OffenseHeadQuaters";

        BeforeBattle(false);
        InBattle(false);
        rank = StatisticsManager.SM.GetDetails("Player_Rank");
        currentRankProps = rankProps[rank - 1];
        generator = myGeneratedMap.gameObject.GetComponent<PathGenerator>();
        generator.OnPercentChange += UpdatePercentValue;
        generator.SetValuesAndGenerate(currentRankProps);
        spawnPosition = generator.spawnPointPosition;
        gateBroken = false;

        //Get referece to all Windows
        resultPanel = GameResultPanel.Instance();
        pausePanel = PausePanel.Instance();

        //Set Up all Actions
        SetAllActions();
    }
 public void SetValuesAndGenerate(ScriptableRankProperties props)
 {
     mapSize = props.mapSize;
     turn = props.turns;
     arrowTowerCount = props.numOfArrowTowers;
     bombTowerCount = props.numOfBombTowers;
     groundBarricadeCount = props.numOfGroundBarricade;
     blockBarricadeCount = props.numOfBlockBarricade;
     percentIncrement = 80 / (turn/2);
     Generate();
 }