Exemplo n.º 1
0
        public void Update()
        {
            if (Game3Global.GetGameState() == GameState.GS_PLAY)
            {
                //countdown Timer
                if (parashootCount > 0)
                {
                    timer -= Time.deltaTime;
                    if (timer <= 0)
                    {
                        timer += Random.Range(lvling.minParashootLength, lvling.maxParashootLength);
                        float   randPos  = Random.Range(-2.0f, 2.0f);
                        Vector2 spawnPos = parentObj.transform.position;
                        spawnPos.x += randPos;
                        //spawn Parashoot
                        GameObject obj = GameObject.Instantiate(Game3Global.pGlobal.ParashootPrefabs) as GameObject;
                        obj.transform.position = spawnPos;
                        obj.transform.parent   = parentObj.transform;
                        Parashoot pComp = obj.GetComponent <Parashoot>();
                        //random Att
                        ParashootType ran            = (ParashootType)Random.Range(0, lvling.CatagoryCount + 1);
                        float         parashootSpeed = Random.Range(lvling.minParashootSpeed, lvling.maxParashootSpeed);
                        pComp.SetParentWave(this);
                        pComp.SetParashoot(ran);
                        pComp.SetSpeed(parashootSpeed);

                        parashootCount--;
                    }
                }
            }
//			if (parashootCount <= 0)
//			{
//				Destroy (gameObject);
//			}
        }
Exemplo n.º 2
0
 public void DetachParashoot(ParashootType _type)
 {
     type = _type;
     Game3Global.pGlobal.AddGameplayObject(gameObject);
     gameObject.AddComponent <Rigidbody2D>();
     GetComponent <Collider2D>().enabled = true;
     IsDetach = true;
 }
Exemplo n.º 3
0
        public void SetParashoot(ParashootType _type)
        {
            type = _type;

            switch (type)
            {
            case ParashootType.PARA_DRUG:
            {
                int    idx     = Random.Range(0, Game3Global.pGlobal.parashootObjectList[0].spriteList.Length);
                Sprite pSymbol = Game3Global.pGlobal.parashootSymbolDrug;
                Sprite pObject = Game3Global.pGlobal.parashootObjectList[0].spriteList[idx];
                //set object sprite
                ParashootSymbol.sprite = pSymbol;
                parashootObject.setObjectSprite(pObject);
            }
            break;

            case ParashootType.PARA_FOOD:
            {
                int    idx     = Random.Range(0, Game3Global.pGlobal.parashootObjectList[1].spriteList.Length);
                Sprite pSymbol = Game3Global.pGlobal.parashootSymbolFood;
                Sprite pObject = Game3Global.pGlobal.parashootObjectList[1].spriteList[idx];
                //set object sprite
                ParashootSymbol.sprite = pSymbol;
                parashootObject.setObjectSprite(pObject);
            }
            break;

            case ParashootType.PARA_LIP:
            {
                int    idx     = Random.Range(0, Game3Global.pGlobal.parashootObjectList[2].spriteList.Length);
                Sprite pSymbol = Game3Global.pGlobal.parashootSymbolLip;
                Sprite pObject = Game3Global.pGlobal.parashootObjectList[2].spriteList[idx];
                //set object sprite
                ParashootSymbol.sprite = pSymbol;
                parashootObject.setObjectSprite(pObject);
            }
            break;

            case ParashootType.PARA_MED:
            {
                int    idx     = Random.Range(0, Game3Global.pGlobal.parashootObjectList[3].spriteList.Length);
                Sprite pSymbol = Game3Global.pGlobal.parashootSymbolMedic;
                Sprite pObject = Game3Global.pGlobal.parashootObjectList[3].spriteList[idx];
                //set object sprite
                ParashootSymbol.sprite = pSymbol;
                parashootObject.setObjectSprite(pObject);
            }
            break;

            case ParashootType.PARA_POISON:
            {
                int    idx     = Random.Range(0, Game3Global.pGlobal.parashootObjectList[4].spriteList.Length);
                Sprite pSymbol = Game3Global.pGlobal.parashootSymbolPoison;
                Sprite pObject = Game3Global.pGlobal.parashootObjectList[4].spriteList[idx];
                //set object sprite
                ParashootSymbol.sprite = pSymbol;
                parashootObject.setObjectSprite(pObject);
            }
            break;

            case ParashootType.PARA_OTHER:
            {
                int    idx     = Random.Range(0, Game3Global.pGlobal.parashootObjectList[5].spriteList.Length);
                Sprite pObject = Game3Global.pGlobal.parashootObjectList[5].spriteList[idx];
                //set object sprite
                ParashootSymbol.gameObject.SetActive(false);
                parashootObject.setObjectSprite(pObject);
            }
            break;
            }
        }