Ejemplo n.º 1
0
        /// <summary>
        /// [EndAIFunction]
        /// 実行中の関数を登録解除する, 複数実行されている場合実行中のもののみ解除される
        /// 引数1: 更新識別子
        /// </summary>
        public void EndAIFunction(UpdateIdentifier updateIdentifier)
        {
            //停止
            timer.Stop();

            //関数新規割り当て
            aiAgent.AllocateFunction();
        }
Ejemplo n.º 2
0
 //Updateみたいなもん
 public override void AIUpdate(UpdateIdentifier updateIdentifier)
 {
     //ターゲットとの距離がradius以下になったら終了
     //もしくは、タイムアウト秒数まで実行から経過したら終了
     //timer.elapsedTimeはAIBeginがよびだされてから経過した秒数です
     //EndAIFunctionが終了関数, これか再割当てがなければ終了しません
     if (timer.elapasedTime > m_timeoutSeconds ||
         (m_target.position - transform.position).sqrMagnitude <= m_goalRadius * m_goalRadius)
     {
         Debug.Log("Goal!!");
         EndAIFunction(updateIdentifier);
     }
 }
Ejemplo n.º 3
0
        public override void AIUpdate(UpdateIdentifier updateIdentifier)
        {
            if (m_isEnabledNavMesh == false | m_kamikazeCommand.timeoutSeconds < timer.elapasedTime)
            {
                EndAIFunction(updateIdentifier);
                m_kamikazeCommand.EndKamikaze();
                return;
            }

            if (m_visibility.IsHitVisibility())
            {
                aiAgent.AllocateFunction();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// [EndAIFunction]
        /// 実行中の関数を登録解除する, 複数実行されている場合実行中のもののみ解除される
        /// 引数1: 更新識別子
        /// </summary>
        public void EndAIFunction(UpdateIdentifier updateIdentifier)
        {
            //停止
            timer.Stop();

            //非割り込み
            if (!updateIdentifier.isParallel)
            {
                //関数新規割り当て
                aiAgent.AllocateFunction();
            }
            //割り込み
            else
            {
                //削除
                aiAgent.EndParallelFunction(aiAgent.nowRunningParallelIndex);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// [AIUpdate]
        /// Updateフレームに呼ばれるコールバック関数, EndAIFunctionを呼び出す場合引数1が必要
        /// 引数1: 更新識別子
        /// </summary>
        public override void AIUpdate(UpdateIdentifier updateIdentifier)
        {
            if (m_markTarget == null || m_markingObjectInfo == null)
            {
                EndAIFunction(updateIdentifier);
                return;
            }

            if (timer.elapasedTime >= m_rotationTime)
            {
                m_markingObjectInfo.message.SendMessage(new MarkerInfo(m_linkMarking, m_attack));
                m_kamikazeCommand.EndKamikaze();
                EndAIFunction(updateIdentifier);
                return;
            }

            m_rotationApplyObject.transform.rotation =
                Quaternion.Slerp(transform.rotation, m_markingObjectInfo.goalRotation, m_rotationSpeed * Time.deltaTime);
        }
Ejemplo n.º 6
0
    /// <summary>
    /// [AIUpdate]
    /// Updateフレームに呼ばれるコールバック関数, EndAIFunctionを呼び出す場合引数1が必要
    /// 引数1: 更新識別子
    /// </summary>
    public override void AIUpdate(UpdateIdentifier updateIdentifier)
    {
        if ((m_followTransform.position - transform.position).sqrMagnitude < m_arrivalDistance * m_arrivalDistance)
        {
            navMeshAgent.isStopped = true;
        }
        else
        {
            navMeshAgent.isStopped = false;
        }

        if (navMeshAgent.velocity.sqrMagnitude >=
            m_animationChangeSpeed * m_animationChangeSpeed)
        {
            m_animationController.editAnimation.SetStateRun();
        }
        else
        {
            m_animationController.editAnimation.SetStateStand();
        }

        Vector3 absoluteNotYNormalized = (dogAIAgent.linkPlayer.transform.position - transform.position);

        absoluteNotYNormalized.y = 0.0f;
        if (absoluteNotYNormalized.sqrMagnitude >= 1.0f)
        {
            absoluteNotYNormalized = absoluteNotYNormalized.normalized;

            if (navMeshAgent.pathStatus != UnityEngine.AI.NavMeshPathStatus.PathPartial &&
                Vector3.Angle(absoluteNotYNormalized, transform.forward) > m_arrivalRotation)
            {
                Quaternion lookRotation = Quaternion.LookRotation(absoluteNotYNormalized, transform.up);
                transform.rotation = Quaternion.Slerp(transform.rotation, lookRotation, m_rotationSpeed * Time.deltaTime);
            }
        }

        if (timer.elapasedTime >= m_moveSeconds)
        {
            EndAIFunction(updateIdentifier);
        }
    }
Ejemplo n.º 7
0
        /// <summary>
        /// [AIUpdate]
        /// Updateフレームに呼ばれるコールバック関数, EndAIFunctionを呼び出す場合引数1が必要
        /// 引数1: 更新識別子
        /// </summary>
        public override void AIUpdate(UpdateIdentifier updateIdentifier)
        {
            if (m_target == null)
            {
#if UNITY_EDITOR
                Debug.LogError("Error!! GoingMarkingPoint->AIUpdate, target == null");
#endif
                EndAIFunction(updateIdentifier);
            }

            if (timer.elapasedTime > m_timeoutSeconds)
            {
                EndAIFunction(updateIdentifier);
            }

            //マーキング実行範囲に入ったか判定する
            var collisions = Physics.OverlapSphere(transform.position, m_overlapRadius, m_overlapLayerMask);

            if (collisions.Length == 0)
            {
                return;
            }

            //該当しているか検索ループ
            foreach (var e in collisions)
            {
                Transform         useTransform      = e.gameObject.transform;
                ProvideMainObject provideMainObject = useTransform.GetComponent <ProvideMainObject>();

                if ((provideMainObject != null &&
                     m_target.GetInstanceID() == provideMainObject.mainObject.GetInstanceID()) ||
                    provideMainObject == null &&
                    m_target.GetInstanceID() == useTransform.GetInstanceID())
                {
                    aiAgent.ForceSpecifyFunction(m_function);
                }
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// [AIUpdate]
 /// Updateフレームに呼ばれるコールバック関数, EndAIFunctionを呼び出す場合引数1が必要
 /// 引数1: 更新識別子
 /// </summary>
 public override void AIUpdate(UpdateIdentifier updateIdentifier)
 {
     EndAIFunction(updateIdentifier);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// [AILateUpdate]
 /// LateUpdateフレームに呼ばれるコールバック関数, EndAIFunctionを呼び出す場合引数1が必要
 /// 引数1: 更新識別子
 /// </summary>
 public virtual void AILateUpdate(UpdateIdentifier updateIdentifier)
 {
 }
        private async void btnComplete_Click(object sender, EventArgs e)
        {
            string sURL        = this.txtChallenge.Text;
            bool   onceMessage = false;

            if (!string.IsNullOrEmpty(sURL))
            {
                while (true)
                {
                    var wrGETURL = WebRequest.Create(sURL + "/index.html") as HttpWebRequest;
                    //WebProxy myProxy = new WebProxy("myproxy", 80);
                    //myProxy.BypassProxyOnLocal = true;
                    //wrGETURL.Proxy = myProxy;
                    wrGETURL.Proxy = WebRequest.GetSystemWebProxy();

                    HttpWebResponse response;
                    try
                    {
                        response = wrGETURL.GetResponse() as HttpWebResponse;
                    }
                    catch (WebException ex)
                    {
                        response = ex.Response as HttpWebResponse;
                    }

                    if (response.StatusCode == HttpStatusCode.OK)
                    {
                        using (Stream objStream = response.GetResponseStream())
                        {
                            var objReader = new StreamReader(objStream);
                            var str       = objReader.ReadToEnd();

                            if (str == this.txtKey.Text)
                            {
                                break;
                            }
                        }
                    }

                    await Task.Delay(1000);

                    if (!onceMessage)
                    {
                        this.listBox1.Items.Add("Waiting for file to be uploaded.");
                    }
                    onceMessage = true;
                }
            }

            var idref = Registrator.GetIdentifier(this.txtDomain.Text);
            var state = new UpdateIdentifier {
                IdentifierRef = idref
            }.GetValue <AuthorizationState>();

            if (state.Status != "valid")
            {
                state =
                    new SubmitChallenge {
                    IdentifierRef = idref, ChallengeType = "http-01"
                }.GetValue <AuthorizationState>();
                int countPending = 0;
                while (state.Status == "pending")
                {
                    this.listBox1.Items.Add("Status is still 'pending', waiting for it to change...");
                    await Task.Delay((countPending + 1) * 1000);

                    state = new UpdateIdentifier {
                        IdentifierRef = idref
                    }.GetValue <AuthorizationState>();
                    countPending++;
                }
            }

            if (state.Status == "valid")
            {
                var certificateInfo = new GetCertificate {
                    CertificateRef = "cert1"
                }.GetValue <CertificateInfo>();

                if (certificateInfo == null)
                {
                    new NewCertificate {
                        IdentifierRef = idref, Alias = "cert1", Generate = SwitchParameter.Present
                    }
                }
Ejemplo n.º 11
0
 /// <summary>
 /// [AIUpdate]
 /// Updateフレームに呼ばれるコールバック関数, EndAIFunctionを呼び出す場合引数1が必要
 /// 引数1: 更新識別子
 /// </summary>
 public abstract void AIUpdate(UpdateIdentifier updateIdentifier);
Ejemplo n.º 12
0
 /// <summary>
 /// [AIFixedUpdate]
 /// FixedUpdateフレームに呼ばれるコールバック関数, EndAIFunctionを呼び出す場合引数1が必要
 /// 引数1: 更新識別子
 /// </summary>
 public virtual void AIFixedUpdate(UpdateIdentifier updateIdentifier)
 {
 }
Ejemplo n.º 13
0
 public override void AIUpdate(UpdateIdentifier updateIdentifier)
 {
     navMeshAgent.destination = m_manageCommander.commander.transform.position;
 }
Ejemplo n.º 14
0
 //Updateみたいなもん
 public override void AIUpdate(UpdateIdentifier updateIdentifier)
 {
     //回転
     transform.Rotate(new Vector3(0, 100, 0) * Time.deltaTime);
 }
Ejemplo n.º 15
0
    /// <summary>
    /// [AIUpdate]
    /// Updateフレームに呼ばれるコールバック関数, EndAIFunctionを呼び出す場合引数1が必要
    /// 引数1: 更新識別子
    /// </summary>
    public override void AIUpdate(UpdateIdentifier updateIdentifier)
    {
        //万が一の無効条件
        if (m_markPoint == null)
        {
            EndAIFunction(updateIdentifier);
            return;
        }
        else if (m_markPoint.isLinked & m_markPoint.isPauseTimer)
        {
            EndAIFunction(updateIdentifier);
            return;
        }

        //state switch
        switch (functionState)
        {
        //突進
        case State.Rushing:
        {
            //半径でOverlapを行う
            var hitCollisions = Physics.OverlapSphere(transform.position, m_rushingArrivalDistance, m_markPointLayerMask);

            //指定ポイントがヒットしているか確認
            for (int i = 0, length = hitCollisions.Length; i < length; ++i)
            {
                //指定ポイントと合致
                if (hitCollisions[i].gameObject.GetInstanceID() == m_markPoint.gameObject.GetInstanceID())
                {
                    //移動, 回転停止
                    navMeshAgent.isStopped = true;
                    dogAIAgent.speedChanger.SetManualAcceleration(0.0f);

                    //回転を決める
                    Vector3 absolute = m_markPointPosition - transform.position;
                    absolute.y       = 0.0f;
                    m_targetRotation = Quaternion.LookRotation(absolute.normalized) * Quaternion.AngleAxis(-90, Vector3.up);
                    //Stateを進める
                    functionState = State.Rotation;
                    //Animation Set
                    m_animationController.editAnimation.SetTriggerMarking();
                    //Timer再スタート
                    timer.Start();
                    break;
                }
            }

            break;
        }

        //回転
        case State.Rotation:
        {
            //指定時間経過でステートを進める
            if (timer.elapasedTime >= m_rotationSeconds)
            {
                m_sePlayer.PlaySE(m_markingSEIndex, true);
                m_markingEffect.SetActive(true);
                functionState = State.Marking;
                timer.Start();
            }

            //回転
            transform.rotation =
                Quaternion.Slerp(transform.rotation, m_targetRotation, m_rotationSpeed * Time.deltaTime);
            break;
        }

        //マーキング実行
        case State.Marking:
        {
            //指定時間経過
            if (timer.elapasedTime >= m_markingSeconds)
            {
                //ポイントをリンクさせる
                m_markPoint.LinkPlayer(dogAIAgent.linkPlayer, dogAIAgent);
                //待て!
                dogAIAgent.SetSitAndStay(true, m_markPoint);
                //Animation Set
                m_animationController.editAnimation.SetTriggerSleepStart();
                //終了
                EndAIFunction(updateIdentifier);
            }

            break;
        }

        default:
            break;
        }
    }
Ejemplo n.º 16
0
 //FixedUpdateみたいなもん, 継承はしなくてもよい
 public override void AIFixedUpdate(UpdateIdentifier updateIdentifier)
 {
 }
Ejemplo n.º 17
0
 //LateUpdateみたいなもん, 継承はしなくてもよい
 public override void AILateUpdate(UpdateIdentifier updateIdentifier)
 {
 }