Exemple #1
0
    // INITIALIZATION ----------------------------------------------------------------------------------------------------



    void Awake()
    {
        GameObject _Sound = GameObject.FindGameObjectWithTag("Sound");

        if (_Sound != null)
        {
            Sound = _Sound.GetComponent <SoundControler>();
        }

        // LOAD GAME DATA
        data = GameData.GetInstance();
        if (data == null)
        {
            Debug.Log("Error - Data not found");
        }

        // LOAD FACTORY COMPONENT
        factory = Factory.GetInstance();
        if (factory == null)
        {
            Debug.Log("Error - Factory not found");
        }
        else
        {
            factory.InitFactory(BLOCK_SIZE, Z_POS, block_ref, request_ref);
        }

        // LOAD GAME AREA
        GAME_AREA = GameObject.FindGameObjectWithTag("Game_Area");
        if (GAME_AREA == null)
        {
            Debug.Log("Error - Game Area not found");
        }

        // LOAD ENDSCREEN
//		GAME_ENDSCREEN = GameObject.FindGameObjectWithTag ("Game_EndScreen");
//		if (GAME_ENDSCREEN == null)     Debug.Log ("Error - EndScreen not found");
//		else
//			GAME_ENDSCREEN.GetComponent<RuleInterfaceComponent>().Deactivate();

        // GET BLOCK STARTING POSITION
        STARTING_POSITION = GameObject.FindGameObjectWithTag("Game_Start").transform.position;
        if (STARTING_POSITION == Vector3.zero)
        {
            Debug.Log("Error - Block Starting Position not found");
        }
        else
        {
            STARTING_POSITION.z = Z_POS;
        }

        // GET REQUEST STARTING POSITION
        AREA_STARTING_POSITION = GameObject.FindGameObjectWithTag("Request_Start").transform.position;
        if (AREA_STARTING_POSITION == Vector3.zero)
        {
            Debug.Log("Error - Requst Starting Position not found");
        }
        else
        {
            AREA_STARTING_POSITION.z = Z_POS;
        }

        // GET RULE LIST
        GameObject go_rulelist = GameObject.FindGameObjectWithTag("RuleList");

        if (go_rulelist == null)
        {
            Debug.Log("Error - Rule List not found");
        }
        else
        {
            ruleList = go_rulelist.GetComponent <RuleList> ();
            ruleList.SendMessage("SetRuleMax", rules_max);
        }
    }