コード例 #1
0
    private void FixedUpdate()
    {
        entity = vc.GetObjectInVisionCone(0f);

        timer -= Time.deltaTime;

        if (entity != null)
        {
            transform.up = (entity.transform.localPosition - transform.localPosition).normalized;

            if (timer < 0)
            {
                timer = shootTime;

                foreach (GameObject proj in projectileList)
                {
                    if (!proj.activeSelf)
                    {
                        proj.transform.localPosition = transform.localPosition;
                        proj.transform.localRotation = transform.localRotation;
                        proj.SetActive(true);
                        break;
                    }
                }
            }
        }
    }
コード例 #2
0
    private void Update()
    {
        entity = vc.GetObjectInVisionCone(0f);

        timer -= Time.deltaTime;

        if (entity != null)
        {
            transform.up = (entity.transform.position - transform.position).normalized;

            if (timer < 0)
            {
                timer = shootTime;

                foreach (GameObject proj in projectileList)
                {
                    if (!proj.activeSelf)
                    {
                        proj.transform.position = transform.position;
                        proj.transform.rotation = transform.rotation;
                        proj.SetActive(true);
                        break;
                    }
                }
            }
        }
        else
        {
            transform.up = GetComponentInParent <Transform>().up;
        }
    }
コード例 #3
0
ファイル: FSMObject.cs プロジェクト: s3784828/shark_AI
    protected virtual void PatrolState()
    {
        pf.FollowPath();

        timer -= Time.deltaTime;
        entity = vc.GetObjectInVisionCone(vc.locateRadius);

        if (timer < 0)
        {
            currentState = SharkState.ROAM;
            RoamStateStart();
        }

        if (entity != null)
        {
            currentState = SharkState.IN_SIGHT;
            InSightStateStart();
        }
    }