Пример #1
0
    void CoinMaker()      //코인생성.
    {
        int maxValue = 1; //코인이 나오는 갯수.
        int chance   = Random.Range(0, 10000);

        if (chance < ValueDeliverScript.coinAddChance)
        {
            maxValue = ValueDeliverScript.coinAddNumber;
        }

        for (int i = 0; i < maxValue; i++)
        {
            //코인 생성 확률 구하기.
            int coinPer100 = Random.Range(0, 100);
            if (coinPer100 < coinChance)
            {
                int coinLevel;
                int isCoinLevel = Random.Range(0, 10000);

                if (isCoinLevel < coin01Chance)
                {
                    coinLevel = 1;
                }
                else if (isCoinLevel < coin01Chance + coin02Chance)
                {
                    coinLevel = 2;
                }
                else
                {
                    coinLevel = 3;
                }

                activate.CoinActivation(transform.position, coinLevel);
            }
        }
    }
Пример #2
0
    void Update()
    {
        //아직 이펙트가 시작하지 않았으면 아래 내용을 실행하지 않는다.
        if (isFinishFx == false)
        {
            return;
        }
        //블랙홀이 작동을 시작하고 BalckHallActive() 메소드가 시작하지 않으면 이 아래 부분을 실행한다//
        if (BlackHoleBombScript.blackHallOn == true)
        {
            if (isBalckHallActive == false)
            {
                //한번 들어왔은 다시는 이 조건문 안으로 못들어오게 막아준다//
                isBalckHallActive = true;
                //골든웜홀 파괴모드로 들어간다//
                DestroyUfo();
            }
        }
        else if (isAttacked == true && megaCoin == false)
        {
            if (lerpTime < 1f)
            {
                lerpTime += Time.deltaTime * lrMoveSpeed;
                bPos      = Vector3.Slerp(nowPosition, nextPosition, lerpTime);
                //Debug.Log("움직인다!!! ::: 첫 위치 ::: " + nowPosition + " ::: 나중위치 ::: " + nextPosition + " ::: 러프 ::: " + lerpTime);
            }
            else
            {
                bPos = nowPosition = nextPosition;

                NextPosition();
                isAttacked = false;
                lerpTime   = 0;
            }
        }

        if (Mathf.Abs(transform.position.x) > 35)
        { // 지정된 좌우 범위를 넘어서면 사라지게 함.
            instanceMissionScript.NewMission();
            instanceMission.animation.Play("InstanceMissionApearAnim01");
            ValueDeliverScript.enemyInGame.Remove(this.gameObject);
            gameObject.SetActive(false);
        }

        if (megaCoin)
        { //처치시 동전 드랍. 폭발.시작.
            animation.Stop("GoldenWhole01");
            if (coinTime + 0.05f <= Time.timeSinceLevelLoad)
            {
                activate.CoinActivation(transform.position, coinLevel); //3은 코인레벨. 격추시 3개짜리 동전만 출현해줌.
                coinCount++;
                coinTime = Time.timeSinceLevelLoad;
            }

            if (coinCount >= megaCoinCount)
            {
                soundUiControlScript.PcExplo();                              //폭발사운드. 적용.
                activate.ExploActivation(transform.position, 01, "WingBox"); //폭발이펙트 켜짐.
                isFirst = false;

                ValueDeliverScript.enemyInGame.Remove(this.gameObject);
                gameObject.SetActive(false);
            }

            transform.position += new Vector3(Random.Range(-0.3f, 0.3f), Random.Range(-0.3f, 0.3f), Random.Range(-0.3f, 0.3f));
        }

        spendTime += Time.deltaTime;

        //10초가 지나면 골든웜홀을 화면 밖으로 사라지게 해준다.
        if (spendTime > 10f && isOutPosition == false)
        {
            isOutPosition = true;
            OutPosition();
        }
    }