Esempio n. 1
0
 public void Idle_On()
 {
     AniCount     = 0;
     MS           = MoleState.Idle;
     timeForCount = 0;
     timeToWait   = Random.Range(1.0f, 3.0f);
 }
Esempio n. 2
0
 void Update()
 {
     if (curTimer <= 0)
     {
         // move to next state
         if (moleState == MoleState.up)
         {
             moleState = MoleState.down;
             curTimer  = downDur + Random.Range(-1f, 1f) * downDurRan;
         }
         else if (moleState == MoleState.down)
         {
             moleState = MoleState.up;
             curTimer  = upDur;
         }
         else if (moleState == MoleState.hit)
         {
             moleState = MoleState.down;
             curTimer  = downDur + Random.Range(-1f, 1f) * downDurRan;
         }
         anim.SetInteger("MoleState", (int)moleState);
     }
     else
     {
         curTimer -= Time.deltaTime;
     }
 }
Esempio n. 3
0
 //叩かれた
 private void HitMole()
 {
     //モグラなら足を表示
     if (rand_char != 1)
     {
         moleLeg.SetActive(true);
     }
     //モグラを出し切る
     mole.rectTransform.localPosition = new Vector2(mole.rectTransform.localPosition.x, upPosition_Y);
     //表示時間が0なら
     hitAnimTime -= Time.deltaTime;
     if (hitAnimTime <= 0.0f)
     {
         //位置を一番下へ
         mole.rectTransform.localPosition = new Vector2(mole.rectTransform.localPosition.x, downPostion_Y);
         //モグラの足を非表示
         if (rand_char != 1)
         {
             moleLeg.SetActive(false);
         }
         //星を消す
         Destroy(hitEffect);
         state = MoleState.Init;
         //生成数を-1
         moleGameManager.moleNum -= 1;
         //モグラを停止
         gameObject.GetComponent <MoleController>().enabled = false;
     }
 }
Esempio n. 4
0
    public void Close_On()
    {
        AniCount = 0;
        MS       = MoleState.Close;

        GM.scoreModify(-1);
    }
Esempio n. 5
0
    // Use this for initialization
    void Start()
    {
        animtor = GetComponent <Animator>();
        if (Random.Range(0.0f, 1.0f) <= goodRate)
        {
            m_currMole = MoleType.Normal;

            animtor.Play("NormalIN");
        }
        else if (Random.Range(0.0f, 1.0f) <= freezeRate)
        {
            m_currMole = MoleType.Frozen;

            animtor.Play("IceIN");
        }
        else
        {
            m_currMole = MoleType.Evil;

            animtor.Play("BadIN");
        }

        m_hitOnce = false;

        m_currState = MoleState.Enter;
    }
Esempio n. 6
0
 public void Open_On()
 {
     AniCount = 0;
     MS       = MoleState.Open;
     GetComponent <AudioSource>().clip = OpenSound;
     GetComponent <AudioSource>().Play();
 }
Esempio n. 7
0
 void Update()
 {
     if (snoozy)
     {
         return;
     }
     if (state == MoleState.Moving)
     {
         Debug.DrawLine(transform.position, goalPos, Color.yellow);
         if (Vector3.Distance(transform.position, goalPos) > .05f)
         {
             transform.position = Vector3.MoveTowards(transform.position, goalPos, chosenMoveSpeed * Time.deltaTime);
         }
         else
         {
             state = MoleState.Idling;
             animator.SetTrigger("idle");
             timeUntilWander = Random.Range(timeBetweenWander.x, timeBetweenWander.y);
         }
     }
     else if (state == MoleState.Idling)
     {
         if (timeUntilWander <= 0)
         {
             WalkToNewPos();
         }
         else
         {
             timeUntilWander -= Time.deltaTime;
         }
     }
 }
Esempio n. 8
0
 public void Stop()
 {
     active = false;
     if (MS == MoleState.Open || MS == MoleState.Idle)
     {
         MS = MoleState.Close;
     }
 }
Esempio n. 9
0
 public void GetExcited()
 {
     if (snoozy)
     {
         return;
     }
     state = MoleState.Giving;
     animator.SetTrigger("give");
 }
Esempio n. 10
0
    public void Open_On()
    {
        MS       = MoleState.Open;
        aniCount = 0;
        incTime  = 0;

        audio.clip = openSound;
        audio.Play();
    }
Esempio n. 11
0
 public void StopBeingExcited()
 {
     if (snoozy)
     {
         return;
     }
     state = MoleState.Idling;
     animator.SetTrigger("idle");
     timeUntilWander = Random.Range(timeBetweenWander.x, timeBetweenWander.y);
 }
Esempio n. 12
0
    public IEnumerator Wait()
    {
        MS        = MoleState.None;
        Ani_Count = 0;
        float wait_Time = Random.Range(0.5f, 4.5f);

        yield return(new WaitForSeconds(wait_Time));

        Open_On();
    }
Esempio n. 13
0
 //public function for the game manager to manage set the mole's position to down
 public void MoveMoleDown()
 {
     //Only available when moving to and in up position
     if (myState == MoleState.inUp || myState == MoleState.movingUp)
     {
         //Start transition state
         myState        = MoleState.movingDown;
         stateStartTime = Time.time;
     }
 }
Esempio n. 14
0
 //public function for the game manager to manage set the mole's position to up
 public void MoveMoleUp()
 {
     //Only available when moving to and in down position
     if (myState == MoleState.idle || myState == MoleState.movingDown)
     {
         //Start transition state
         myState        = MoleState.movingUp;
         stateStartTime = Time.time;
     }
 }
Esempio n. 15
0
File: Hole.cs Progetto: leedaju/COCO
    public IEnumerator Wait()
    {
        MS        = MoleState.None;
        Ani_Count = 0;
        float wait_Time = Random.Range(0.5f, 4.5f);  // 랜덤으로 시간을 결정한다.

        yield return(new WaitForSeconds(wait_Time)); //랜덤으로 정해진 시간만큼을 기다렸다가 그 다음 줄을 실행

        Open_On();                                   // 랜덤한 시간을 기다렸다가 Open_On을 해서 다시 애니메이션 상태로 돌린다.
    }
Esempio n. 16
0
                //モグラの初期化処理
                private void MoleInit()
                {
                    isUp    = false;
                    onClick = false;

                    moleAppearanceTime = 0.0f;

                    Settings.Instance.SetSettings();
                    moleBeingTime = Settings.Instance.CurrentSettings.BeingTime;
                    hitAnimTime   = 1.0f;

                    //キャラのランダム設定(難易度によって確率変更)
                    if (difficalty == 3)
                    {
                        rand_char = Random.Range(1, 3 + 1);
                    }
                    else if (difficalty == 4)
                    {
                        rand_char = Random.Range(1, 2 + 1);
                    }
                    else
                    {
                        rand_char = Random.Range(1, 5 + 1);
                    }

                    if (rand_char == 1)
                    {
                        rand_notMole = Random.Range(0, 2);
                        if (rand_notMole == 0)
                        {
                            //キノコに設定
                            mole.sprite = mushroomSprite[0];
                            type        = MoleType.Mushroom;
                        }
                        else
                        {
                            //モグラ(メス)に設定
                            mole.sprite = moleGirlSprite[0];
                            type        = MoleType.Girl;
                        }
                    }
                    else
                    {
                        //モグラに設定
                        mole.sprite = moleSprite[0];
                        type        = MoleType.Mole;
                    }

                    if (mole.sprite == moleSprite[0])
                    {
                        moleGameManager.MoleCountPlus();
                    }
                    state = MoleState.Move;
                }
Esempio n. 17
0
 public void None_On()
 {
     AniCount     = 0;
     MS           = MoleState.None;
     timeForCount = 0;
     timeToWait   = Random.Range(3.0f, 8.0f);
     if (!active)
     {
         MS = MoleState.Ready;
     }
 }
Esempio n. 18
0
 public void None_Ing()
 {
     this.GetComponent <Renderer>().material.mainTexture = NoneImage;
     timeForCount += Time.deltaTime;
     if (timeForCount > timeToWait)
     {
         Open_On();
     }
     if (!active)
     {
         MS = MoleState.Ready;
     }
 }
Esempio n. 19
0
        public IActionResult Get()
        {
            var pod       = Environment.GetEnvironmentVariable("POD_NAME");
            var host      = Environment.GetEnvironmentVariable("NODE_NAME");
            var color     = Environment.GetEnvironmentVariable("POD_COLOR");
            var rnd       = new Random();
            var c         = (char)rnd.Next(START, END);
            var character = c.ToString();
            var mole      = new MoleState()
            {
                Name = $"{pod}", CurrentChar = character, Color = color
            };

            return(new OkObjectResult(mole));
        }
Esempio n. 20
0
File: Hole.cs Progetto: leedaju/COCO
    // Catch 상태가 되었다고 알려주는 함수
    public void Catch_On()
    {
        MS        = MoleState.Catch;
        Ani_Count = 0;
        // audio.clip = Catch_Sound;
        //  audio.Play();

        if (GoodMole == false)
        {
            GM.Count_Bad += 1;
        }
        else
        {
            GM.Count_Good += 1;
        }
    }
Esempio n. 21
0
    public void Open_on()
    {
        MS         = MoleState.Open;
        g_AniCount = 0;
        g_AniSpeed = (float)(GM.m_nLimitTime / g_MaxLimitTime * 0.05);

        int a = Random.Range(0, 100);

        if (a <= PerGood)
        {
            GoodMole = true;
        }
        else
        {
            GoodMole = false;
        }
    }
Esempio n. 22
0
                //モグラを動かす
                private void MoleMove()
                {
                    moleAppearanceTime += Time.deltaTime;
                    //叩かれてないかつ上がりきってなければ
                    if (onClick == false && isUp == false)
                    {
                        //上がる
                        mole.rectTransform.localPosition = Vector2.MoveTowards(mole.rectTransform.localPosition, new Vector2(mole.rectTransform.localPosition.x, upPosition_Y), moveSpeed);
                        if (mole.rectTransform.localPosition.y >= upPosition_Y - 0.5f)
                        {
                            //モグラの足をアクティブに
                            if (rand_char != 1)
                            {
                                moleLeg.SetActive(true);
                            }
                            isUp = true;
                        }
                    }
                    else if (onClick == false && isUp == true)
                    {
                        moleBeingTime -= Time.deltaTime;
                        if (moleBeingTime <= 0.0f)
                        {
                            //下がる
                            mole.rectTransform.localPosition = Vector2.MoveTowards(mole.rectTransform.localPosition, new Vector2(mole.rectTransform.localPosition.x, downPostion_Y), moveSpeed);
                            if (mole.rectTransform.localPosition.y <= downPostion_Y + 0.5f)
                            {
                                //モグラの足を非表示
                                if (rand_char != 1)
                                {
                                    moleLeg.SetActive(false);
                                }
                                state = MoleState.Init;
                                //生成数を-1
                                moleGameManager.moleNum -= 1;
                                //停止
                                gameObject.GetComponent <MoleController>().enabled = false;
                            }
                        }
                    }

                    if (onClick == true)
                    {
                        HitMole();
                    }
                }
Esempio n. 23
0
    public void Catch_on()
    {
        MS         = MoleState.Catch;
        g_AniCount = 0;

        GetComponent <AudioSource>().clip = g_CatchSound;
        GetComponent <AudioSource>().Play();

        if (!GoodMole)
        {
            GM.m_nCountBad++;
            GM.AddCombo();
        }
        else
        {
            GM.m_nCountGood++;
            GM.EndCombo();
        }
    }
Esempio n. 24
0
 public void TappedOn()
 {
     Debug.Log(name + "Tapped on");
     if (moleState == MoleState.up)
     {
         moleState = MoleState.hit;
         curTimer  = hitDur;
         anim.SetInteger("MoleState", (int)moleState);
         moleManager.MoleHit();
     }
     else if (moleState == MoleState.down)
     {
         // nothing, maybe mocking sfx
     }
     else if (moleState == MoleState.hit)
     {
         // nothing
     }
 }
Esempio n. 25
0
 public void Close_Ing()
 {
     if (GoodMole)
     {
         GetComponent <Renderer>().material.mainTexture = g_CloseImages2[g_AniCount];
     }
     else
     {
         GetComponent <Renderer>().material.mainTexture = g_CloseImages[g_AniCount];
     }
     g_AniCount++;
     if (g_AniCount >= g_CloseImages.Length)
     {
         // End Close
         StartCoroutine("Wait");
         MS         = MoleState.None;
         g_AniCount = 0;
     }
 }
Esempio n. 26
0
    void WalkToNewPos()
    {
        if (snoozy)
        {
            return;
        }
        goalPos = startPos + (Vector2.right * new Vector2(Random.Range(-maxWanderDistance, maxWanderDistance), 0)).XY();
        state   = MoleState.Moving;

        if (facingRight && goalPos.x < transform.position.x)
        {
            facingRight        = false;
            transform.rotation = Quaternion.Euler(0, 180, 0);
        }
        else if (!facingRight && goalPos.x > transform.position.x)
        {
            facingRight        = true;
            transform.rotation = Quaternion.Euler(0, 0, 0);
        }
        animator.SetTrigger("walk");
    }
Esempio n. 27
0
    public void Open_On()
    {
        MS         = MoleState.Open;
        Ani_count  = 0;
        audio.clip = Open_Sound;
        audio.Play();

        int a = Random.Range(0, 100);

        if (a >= PerGood)
        {
            GoodMole = false;
        }
        else
        {
            GoodMole = true;
        }
        if (GM.GS == GameState.Ready)
        {
            GM.GO();
        }
    }
Esempio n. 28
0
    public void Hit()
    {
        switch (m_currMole)
        {
        case MoleType.Normal:
            // REMOVE SCORE
            m_currState = MoleState.Hit;
            Debug.Log("Normal Mole Hit");
            m_moleManager.GetComponent <MoleGameManagerScript>().IncrementScore(-10, this.transform.position.x, this.transform.position.y);
            break;

        case MoleType.Frozen:
            if (m_hitOnce == false)
            {
                Debug.Log("Ice Mole Hit");
                m_hitOnce = true;
                m_moleManager.GetComponent <MoleGameManagerScript>().IncrementScore(5, this.transform.position.x, this.transform.position.y);
            }
            else
            {
                m_currMole = MoleType.Normal;
                this.GetComponent <SpriteRenderer>().sprite = moleSprites[(int)m_currMole];
                Debug.Log("Ice Mole Convert");
                animtor.Play("NormalIDLE");
                m_moleManager.GetComponent <MoleGameManagerScript>().IncrementScore(15, this.transform.position.x, this.transform.position.y);
            }
            break;

        case MoleType.Evil:
            m_currState = MoleState.Hit;
            Debug.Log("Bad Mole Hit");
            m_moleManager.GetComponent <MoleGameManagerScript>().IncrementScore(20, this.transform.position.x, this.transform.position.y);
            break;

        default:
            break;
        }
    }
Esempio n. 29
0
File: Hole.cs Progetto: leedaju/COCO
    // Open 상태가 되었다고 알려주는 함수
    public void Open_On()
    {
        MS        = MoleState.Open; // 스크립트의 상태를 Open으로 바꾸고
        Ani_Count = 0;              // 애니메이션의 프레임 카운트를 0으로 만드는
        //audio.clip = Open_Sound;
        //audio.Play();

        int a = Random.Range(0, 100); // 0부터 100까지의 숫자 중에 하나를 뽑게 되는 변수

        if (a <= PerGood)             // a가 옳은 두더지보다 나올 확률보다 작은지를 확인
        {
            GoodMole = true;          // 확률보다 낮은 경우 옳은 두더지로
        }
        else
        {
            GoodMole = false; // 그렇지 않은 경우 틀린 두더지로
        }

        if (GM.GS == GameState.Ready)
        {
            GM.GO();
        }
    }
Esempio n. 30
0
 // Use this for initialization
 void Start()
 {
     MS = MoleState.None;
 }
Esempio n. 31
0
    public IEnumerator Wait()
    {
        MS = MoleState.None;
        aniCount = 0;
        incTime = 0;

        float wait_time = Random.Range (0.5f, 4.5f);
        yield return new WaitForSeconds (wait_time);
        Open_On ();
    }
Esempio n. 32
0
    public void Open_On()
    {
        MS = MoleState.Open;
        aniCount = 0;
        incTime = 0;

        audio.clip = openSound;
        audio.Play ();
    }
Esempio n. 33
0
File: Hole.cs Progetto: leedaju/COCO
 // Close 상태가 되었다고 알려주는 함수
 public void Close_On()
 {
     MS        = MoleState.Close;
     Ani_Count = 0;
 }
Esempio n. 34
0
 public void Catch_On()
 {
     MS = MoleState.Catch;
     aniCount = 0;
     incTime = 0;
 }
Esempio n. 35
0
 public void Close_On()
 {
     MS = MoleState.Close;
     aniCount = 0;
     incTime = 0;
 }
Esempio n. 36
0
 public void Idle_On()
 {
     MS = MoleState.Idle;
     aniCount = 0;
     incTime = 0;
 }
Esempio n. 37
0
 public void None_On()
 {
     MS = MoleState.None;
     aniCount = 0;
     incTime = 0;
 }