예제 #1
0
    // Start is called before the first frame update
    void Start()
    {
        gameStart = false;

        stage = 0;

        currentScore = "";
        gameId       = "3464115";
        Advertisement.Initialize(gameId, true);
        adCountDown = PlayerPrefs.GetInt("countDown", 2);
        bosses      = new GameObject[3];
        bosses[0]   = dragonfly;
        bosses[1]   = mantis;
        bosses[2]   = spider;

        dfm       = player.GetComponent <DragonFlyMove>();
        twoPos    = new Vector3[2];
        twoPos[0] = right;
        twoPos[1] = left;

        //UI
        bgImages    = new Sprite[3];
        bgImages[0] = bg1; bgImages[1] = bg2; bgImages[2] = bg3;
        hs1.text    = PlayerPrefs.GetInt("0").ToString();
        hs2.text    = PlayerPrefs.GetInt("1").ToString();
        hs3.text    = PlayerPrefs.GetInt("2").ToString();


        bombLeft = 3;
        bombText.GetComponent <Text>().text = bombLeft.ToString();
        //Main Menu
        gameCam.enabled = false;
        CameraShift();
    }
예제 #2
0
    protected virtual void Start()
    {
        gm            = GameObject.Find("GameManager").GetComponent <GameManager>();
        player        = GameObject.Find("you(Clone)").GetComponent <DragonFlyMove>();
        healthBar     = GameObject.Find("HealthBar");
        bars          = new GameObject[5]; //GameObject.Find("Bar");
        numOfBarsLeft = 5;
        barsText      = GameObject.Find("barsLeftText").GetComponent <Text>();
        timerText     = GameObject.Find("TimeText").GetComponent <Text>();
        barsText.text = "x" + numOfBarsLeft;
        barNum        = 0;
        interval      = 1f;
        for (int i = barNum; i < bars.Length; i++)
        {
            bars[i] = GameObject.Find("Bar" + i);
        }

        currentBar = bars[barNum];

        bossPos      = new Vector3(this.transform.position.x, 2.5f, -1f);
        healthPos    = new Vector3(0, 3.5f, 0f);
        spawnSpot    = new Vector3[5];
        spawnSpot[0] = new Vector3(-1.8f, 4.5f, -1);
        spawnSpot[1] = new Vector3(-0.9f, 4.5f, -1);
        spawnSpot[2] = new Vector3(0, 4.5f, -1);
        spawnSpot[3] = new Vector3(0.9f, 4.5f, -1);
        spawnSpot[4] = new Vector3(1.8f, 4.5f, -1);

        itemSpot    = new Vector3[2];
        itemSpot[0] = new Vector3(-0.5f, 2.5f, -1);
        itemSpot[1] = new Vector3(0.5f, 2.5f, -1);

        ran    = Random.Range(0, 3);
        left   = new Vector3(-1.3f, 2.5f, -1);
        center = new Vector3(0, 2.5f, -1);
        right  = new Vector3(1.3f, 2.5f, -1);

        spriteRenderer = this.GetComponent <SpriteRenderer>();
        originalColor  = spriteRenderer.color;
    }