Ejemplo n.º 1
0
 public void OnBecameInvisible()
 {
     isVisible = false;
     if (canKillCamera)
     {
         if (ChaseManager.InstanceExists())
         {
             ChaseManager.Instance.StartKill(Number);
         }
     }
 }
Ejemplo n.º 2
0
 public void OnBecameVisible()
 {
     isVisible = true;
     if (canKillCamera)
     {
         if (ChaseManager.InstanceExists())
         {
             ChaseManager.Instance.StopKill(Number);
         }
     }
 }
Ejemplo n.º 3
0
        public void FixedUpdate()
        {
            // 倒れさせない
            transform.rotation = new Quaternion(0.0f, transform.rotation.y, 0.0f, transform.rotation.w);

            if (PauseManager.Status == true)
            {
                return;
            }

            if (this.GetComponent <Collider>() != null && this.GetComponent <Collider>().enabled == false)
            {
                return;
            }

            // 加速しないよう設定
            if (GetComponent <Rigidbody>() != null)
            {
                GetComponent <Rigidbody>().velocity = Vector3.zero;
            }

            float distance = Vector3.Distance(transform.position, player.position);

            if (distance < walkRange)
            {
                ChaseManager.playChaseBgm();   // BGMの設定

                Vector3 direction = (player.position - transform.position).normalized;

                string nowTime = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                if ((decimal.Parse(nowTime) - decimal.Parse(startTime)) <= runMilliSeconds)
                {
                    MotionRun();    // 走る
                    direction.x *= accelSpeed;
                    direction.z *= accelSpeed;
                }
                else if ((decimal.Parse(nowTime) - decimal.Parse(startTime)) <= runMilliSeconds + restMilliSeconds)
                {
                    MotionWalk();   // 歩く
                    direction.x *= speed;
                    direction.z *= speed;
                }
                else
                {
                    MotionRun();    // 走る
                    direction.x *= accelSpeed;
                    direction.z *= accelSpeed;
                    startTime    = nowTime;
                }
                // 本オブジェクトの座標を取得
                Vector3 workVector3 = transform.position + direction;
                // 進行方向を変更した後にキャラクタを動かす
                transform.LookAt(workVector3);
                transform.position = workVector3;
            }
            else
            {
                ChaseManager.StopChaseBgm();   // BGMの設定

                MotionWait();
            }
        }