コード例 #1
0
ファイル: MainCSharp.cs プロジェクト: truonghuy/capir
    /******************** Functions ***************************/


    /// <summary>
    /// Wakens this instance.
    /// </summary>
    /// <remarks>
    /// Awake is used for reading the map file and initializing the characters
    /// to make sure that all NPCs are created
    /// before Start routine in each NPC is called.
    /// </remarks>
    void Awake()
    {
        // widescreen orientation
        Screen.orientation = ScreenOrientation.Portrait;

        //levelString = levelFile.text;
        GameObject go = GameObject.FindGameObjectWithTag("LevelChoice");

        currLevel = int.Parse(go.GetComponent <LevelInfoScript>().chosenLevel) - 1;
        //levelString = "level" + go.GetComponent<LevelInfoScript>().chosenLevel + ".tmx";


        capirBox = new CapirBox(this);


        numLevels   = 4;
        solvedLevel = new List <bool>();
        for (int i = 0; i < numLevels; i++)
        {
            solvedLevel.Add(false);
        }

        monsters = new List <GameObject>();
        state    = new State();

        // agent and helper always exist
        agent  = Instantiate(agentCube, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
        helper = Instantiate(helperCube, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;


        setUpLevel(currLevel);

        startLevel();
    }
コード例 #2
0
    //
    /// <summary>
    /// Start this instance, used for initialization.
    /// </summary>
    void Start()
    {
        // if agentPersistence is not set, set it to 0.8
        if (agentPersistence == 0)
        {
            agentPersistence = 0.8f;
        }

        isActing    = false;
        movingSteps = 0;

        levelGenerator = GameObject.FindWithTag("LevelGenerator").GetComponent <MainCSharp>();

        capirBox = levelGenerator.capirBox;
    }