예제 #1
0
 public void AddToScene(ChickenInfo info)
 {
     facingDirection = info.facingDirection;
     this.SetupAnimations();
     renderInFrontOfPlayer = true;
     position    = info.position;
     mapObjectId = (short)info.mapObjectId;
     this.SetState(ChickenState.e_Pecking);
     currentAnim = (short)ChickenAnimation.n_Peck;
     (anim[currentAnim]).PlayOnce();
     rotation = 0.0f;
 }
예제 #2
0
    //---------------------------------------------------------------------------------------------------------------------------------------------

    //小雞演出
    private IEnumerator Cor_Performance()
    {
        while (true)
        {
            yield return(new WaitForSeconds(bornFrequency)); //等待指定時間

            int         _dice = Random.Range(0, chickenSetting.Count);
            ChickenInfo _info = chickenSetting[_dice]; //隨機抽取一個設定

            StartCoroutine(Cor_Born(_info));           //產生小雞
        }
    }
예제 #3
0
    //產生小雞
    private IEnumerator Cor_Born(ChickenInfo info)
    {
        for (int i = 0; i < info.lineCount; i++)
        {
            GameObject  _go     = GetChickenObject();
            ChickenMove _moving = _go.GetComponent <ChickenMove>();                             //取得腳本

            float randomScale = Random.Range(info.randomScaleRange.x, info.randomScaleRange.y); //尺寸隨機

            _moving.Move(randomScale, info.bornPos, info.targetPos, info.duration);             //開始移動程序

            yield return(new WaitForSeconds(info.lineSpacingTime));                             //間隔時間差
        }
    }