Example #1
0
    void Start()
    {
        m_StartUI = GameObject.Find("Start_UI");
        m_GameUI  = GameObject.Find("Game_UI");

        m_PlayerController = GameObject.Find("cube_books").GetComponent <PlayerCotroller>();


        m_Score_Lable     = GameObject.Find("Score_Lable").GetComponent <UILabel>();
        m_Gem_Lable       = GameObject.Find("Gem_Lable").GetComponent <UILabel>();
        m_GameScore_Lable = GameObject.Find("GameScore_Lable").GetComponent <UILabel>();
        m_GameGem_Lable   = GameObject.Find("GameGem_Lable").GetComponent <UILabel>();

        PlayButton = GameObject.Find("play_btn");
        m_Left     = GameObject.Find("Left");
        m_Right    = GameObject.Find("Right");
        //开始委托事件
        UIEventListener.Get(PlayButton).onClick = PlayButtonClick;
        UIEventListener.Get(m_Left).onClick     = Left;
        UIEventListener.Get(m_Right).onClick    = Right;
        Init();

        m_StartUI.SetActive(true);
        m_GameUI.SetActive(false);
    }
Example #2
0
    private Color colorWall = new Color(87 / 255f, 93 / 255f, 169 / 255f);   //墙体颜色

    void Start()
    {
        //获取相关元素
        m_prefab_tile       = Resources.Load("tile_white") as GameObject;
        m_prefab_wall       = Resources.Load("wall2") as GameObject;
        m_prefab_spikes     = Resources.Load("moving_spikes") as GameObject;
        m_prefab_sky_spikes = Resources.Load("smashing_spikes") as GameObject;
        m_prefab_gem        = Resources.Load("gem 2") as GameObject;

        m_Transform       = gameObject.GetComponent <Transform>();                          //给父子关系创造一个Transform桥梁
        m_PlayerCotroller = GameObject.Find("cube_books").GetComponent <PlayerCotroller>(); //获取角色的PlayerController

        CreatMapItem(0);                                                                    //从0开始生成地图
    }
Example #3
0
 // Start is called before the first frame update
 void Start()
 {
     playerCotrollerScript = GameObject.Find("Player").GetComponent <PlayerCotroller>();
     InvokeRepeating("SpawnObstacle", startDelay, repeatRate);
 }
Example #4
0
 // Start is called before the first frame update
 void Start()
 {
     playerCotrollerScript = GameObject.Find("Player").GetComponent <PlayerCotroller>();
 }
Example #5
0
 // Start is called before the first frame update
 void Start()
 {
     player = GameObject.Find("Player").GetComponent <PlayerCotroller>();
     agent  = GetComponent <NavMeshAgent>();
     agent.SetDestination(player.transform.position);
 }