Ejemplo n.º 1
0
    private EnemyCreator enemy_creator = null;                  // 방해 캐릭터 크리에이터.

    // ================================================================ //
    // MonoBehaviour에서 상속.

    void    Start()
    {
        this.player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControl>();

        //

        this.last_block.is_created = false;

        this.level_control = new LevelControl();
        this.level_control.initialize();
        this.level_control.loadLevelData(this.level_data_text);

        this.player.level_control = this.level_control;

        //

        this.game_root     = this.gameObject.GetComponent <GameRoot>();
        this.block_creator = this.gameObject.GetComponent <BlockCreator>();
        this.coin_creator  = this.gameObject.GetComponent <CoinCreator>();
        this.enemy_creator = this.gameObject.GetComponent <EnemyCreator>();

        this.block_creator.map_creator = this;
        this.coin_creator.map_creator  = this;
        this.enemy_creator.map_creator = this;

        //

        this.create_floor_block();
    }
Ejemplo n.º 2
0
 private void Start()
 {
     nrOfCreatedCells = 0;
     w = blockPrefab.GetComponent <Renderer>().bounds.size.x; // width of a block
     visitedCellsTable = new Hashtable();
     coinCreator       = coinHolder.GetComponent <CoinCreator>();
     scoreChanger      = GameObject.FindGameObjectWithTag("ScoreMaster").GetComponent <ScoreChanger>();
 }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        Ground = GameObject.Find("Ground");
        cc     = GameObject.Find("CoinCreator").GetComponent <CoinCreator>();
        ec     = GameObject.Find("Enemy").GetComponent <EnemyCreato>();

        ic = GameObject.Find("ItemBox").GetComponent <ItemCreator>();
    }
Ejemplo n.º 4
0
 private void Start()
 {
     coinCreator             = GameObject.FindGameObjectWithTag("CoinHolder").GetComponent <CoinCreator>();
     camera                  = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>();
     coinSign                = GameObject.FindGameObjectWithTag("CoinSign");
     fireWorksParticelSystem = fireworksPrefab.GetComponent <ParticleSystem>();
     audioSource             = GetComponent <AudioSource>();
 }
Ejemplo n.º 5
0
    /// <summary>
    /// 回到起始点
    /// </summary>
    void BackToStart()
    {
        float yPosOffset = Random.Range(3, 20) * 0.1f; //随机高度偏移
        float xPosOffset = Random.Range(5, 15) * 0.1f; //随机水平偏移

        groundTranform.position = start.position + new Vector3(xPosOffset, yPosOffset, 0);

        // 随机生成金币
        CoinCreator.RandomCreate(groundTranform.position);
    }
Ejemplo n.º 6
0
    // ================================================================ //
    // MonoBehaviour에서 상속.

    void    Start()
    {
        this.next_step     = STEP.RUN;
        this.current_speed = SPEED_MIN;

        this.score_control = ScoreControl.getInstance();
        this.coin_creator  = CoinCreator.getInstance();

        this.anim_player = this.transform.GetComponentInChildren <Animation>();                 //motion.

        this.sound_control = GameObject.Find("SoundRoot").GetComponent <SoundControl>();
    }
Ejemplo n.º 7
0
    // Start is called before the first frame update
    void Awake()
    {
        // Find our coin creator.
        coinCreator = FindObjectOfType <CoinCreator>();

        // Get the length of the platform that we are about to generate.

        // we will first need to grab our global object pool and see if they are a platform.
        // we can do this by determining if they have a box collider or not.
        // if they do, we are going to increment an int that we will then use in determining platform length.

        int platformAmount = 0;

        gp.CreatePool();
        for (int i = 0; i < gp.pooledWorldObjects.Count; i++)
        {
            if (gp.pooledWorldObjects[i].GetComponent <BoxCollider2D>())
            {
                platformAmount++;
            }
        }
        platformWidths = new float[platformAmount];



        // For every object in our platform object pools, we are going to set the corresponding array index
        // within 'platformWidths' to be that of the platform we are looking at.
        for (int i = 0; i < gp.pooledWorldObjects.Count; i++)
        {
            if (gp.pooledWorldObjects[i].tag != "KillVolume" && gp.pooledWorldObjects[i].tag != "Coin" && gp.pooledWorldObjects[i].tag != "PowerUp")
            {
                platformWidths[i] = gp.pooledWorldObjects[i].GetComponent <BoxCollider2D>().size.x;
            }
        }

        minHeight = transform.position.y;
        maxHeight = maxHeightPoint.position.y;
    }
Ejemplo n.º 8
0
    // ================================================================ //
    // MonoBehaviour からの継承.
    void Start()
    {
        this.player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerControl>();

        //

        this.last_block.is_created = false;

        this.level_control = new LevelControl();
        this.level_control.initialize();
        this.level_control.loadLevelData(this.level_data_text);

        this.player.level_control = this.level_control;

        //

        this.game_root     = this.gameObject.GetComponent<GameRoot>();
        this.block_creator = this.gameObject.GetComponent<BlockCreator>();
        this.coin_creator  = this.gameObject.GetComponent<CoinCreator>();
        this.enemy_creator = this.gameObject.GetComponent<EnemyCreator>();

        this.block_creator.map_creator = this;
        this.coin_creator.map_creator = this;
        this.enemy_creator.map_creator = this;

        //

        this.create_floor_block();
    }
Ejemplo n.º 9
0
    public MapCreator map_creator      = null;                  // 맵 크리에이터.

    // ================================================================ //

    public static CoinCreator       getInstance()
    {
        CoinCreator coin_creator = GameObject.FindGameObjectWithTag("Game Root").GetComponent <CoinCreator>();

        return(coin_creator);
    }
Ejemplo n.º 10
0
    // ================================================================ //
    // MonoBehaviour에서 상속.
    void Start()
    {
        this.next_step     = STEP.RUN;
        this.current_speed = SPEED_MIN;

        this.score_control = ScoreControl.getInstance();
        this.coin_creator  = CoinCreator.getInstance();

        this.anim_player = this.transform.GetComponentInChildren<Animation>();		//motion.

        this.sound_control = GameObject.Find("SoundRoot").GetComponent<SoundControl>();
    }