Пример #1
0
    private void Update()
    {
        // 시야에 없으면서 동시에 추적 시간 5초가 넘었을 시에 아이들로 돌아온다?
        // 복귀타이머 -> 복귀
        // 추적상태에서 attack으로 넘어갈 때 2초 후 공격 시작하는 형식으로 그 사이 애니메이션 작동

        //if (Vector3.Distance(_manager.PlayerTransform.position, transform.position) >= _manager.Stat.AttackRange)
        if (!GameLib.DetectCharacter2(_manager.Sight, _manager.PlayerCS))
        {
            _manager.SetState(DroneState.IDLE);
            return;
        }
        //if (GameLib.DetectCharacter2(_manager.Sight, _manager.PlayerCS))
        //{
        //    _manager.SetState(DroneState.ATTACKDELAY);
        //    return;
        //}
        if (Vector3.Distance(_manager.PlayerTransform.position, transform.position) < _manager.Stat.AttackRange)
        {
            _manager.SetState(DroneState.ATTACKDELAY);
            return;
        }
        //_manager.CC.CKMove(_manager.PlayerTransform.position, _manager.Stat);
        //transform.LookAt(_manager.PlayerTransform);
    }
Пример #2
0
    private void Update()
    {
        _time += Time.deltaTime;

        if (_time > _animTime)
        {
            _manager.SightLight[1].SetActive(true);
            _manager.Sight.transform.gameObject.SetActive(true);
        }

        if (GameLib.DetectCharacter2(_manager.Sight, _manager.PlayerCS))
        {
            _manager.SetState(SauronState.ATTACK);

            _manager.SightLight[1].SetActive(false);

            _manager.SightLight[3].SetActive(true);
        }


        if (_time > _sightTime)
        {
            _manager.SetState(SauronState.IDLE);
            _manager.Sight.transform.Rotate(Vector3.left * 180);
            _time = 0;
            _manager.SightLight[1].SetActive(false);
        }
    }
Пример #3
0
    private void Update()
    {
        //_manager.CC.CKMove(destination, _manager.Stat);
        //transform.LookAt(destination);

        if (Vector3.Distance(destination, transform.position) < 0.3f)
        {
            _manager.SetState(MP01State.IDLE);
            return;
        }

        //시야에 있다.
        if (GameLib.DetectCharacter2(_manager.Sight, _manager.PlayerCS))
        {
            _manager.SetState(MP01State.WATCH);
            _manager.SightLight[0].SetActive(false);
            _manager.SightLight[1].SetActive(true);
            return;
        }
        if (_manager.isAlertPatrol)
        {
            timer += Time.deltaTime;
            _manager.SightLight[0].SetActive(false);
            _manager.SightLight[1].SetActive(true);
            if (timer >= fifteen)
            {
                timer = 0;
                _manager.SightLight[0].SetActive(true);
                _manager.SightLight[1].SetActive(false);
                _manager.isAlertPatrol = false;
            }
        }
    }
Пример #4
0
    private void Update()
    {
        _time += Time.deltaTime;

        //if(_time >=_scanTime && _scanCount > 0)
        //{
        //    _manager.SetState(DroneState.SCANCHASE);
        //    _time = 0;
        //    --_scanCount;
        //    _manager.isScan = true;
        //}


        if (GameLib.DetectCharacter2(_manager.Sight, _manager.PlayerCS) && !_manager.isScan)
        {
            _manager.SetState(DroneState.CHASE);
            return;
        }
        //if (!GameLib.DetectCharacter2(_manager.Sight, _manager.PlayerCS) && !_manager.isScan)
        //{
        //    _manager.SetState(DroneState.IDLE);
        //    return;
        //}
        if (Vector3.Distance(destination, transform.position) < 3f)// && !_manager.isScan)
        {
            _manager.SetState(DroneState.IDLE);
            return;
        }
        if (_manager.PlayerTransform.position.y > transform.position.y + 9f)
        {
            _manager.SetState(DroneState.GOUPSTAIR);
            return;
        }
    }
Пример #5
0
    private void Update()
    {
        //_manager.Sight.enabled = false;
        _manager.Sight.transform.gameObject.SetActive(false);

        if (GameLib.DetectCharacter2(_manager.Sight, _manager.PlayerCS))
        {
        }

        _time += Time.deltaTime;
        if (_time > _idleTime)
        {
            _manager._sightCount++;

            if ((_manager._sightCount % 2) == 1)
            {
                _manager.SetState(SauronState.RIGHTSIGHT);
            }
            if ((_manager._sightCount % 2) == 0)
            {
                _manager.SetState(SauronState.LEFTSIGHT);
            }

            _time = 0;
        }
    }
Пример #6
0
 private void Update()
 {
     if (!GameLib.DetectCharacter2(_manager.Sight, _manager.PlayerCS) && isRecognition)
     {
         //인식시간보다 덜 인식했다.
         if (_time < ReconCapture)
         {
             _manager.SetState(MP01State.ALERT);
             //_manager.SightLight[1].SetActive(true);
             return;
         }
     }
 }
Пример #7
0
    private void FixedUpdate()
    {
        playerTrans = new Vector3(_manager.PlayerTransform.position.x, transform.position.y, _manager.PlayerTransform.position.z);
        transform.LookAt(playerTrans);

        if (GameLib.DetectCharacter2(_manager.Sight, _manager.PlayerCS))
        {
            _manager._UIs[2].gameObject.SetActive(true);
            _time += Time.deltaTime;
            if (!isRecognition)
            {
                _manager._lastTransform.position = transform.position;
                lastvector = new Vector3(_manager._lastTransform.position.x, transform.position.y, _manager._lastTransform.position.z);
                _manager._lastPlayerTransform.position = _manager.PlayerTransform.position;
                lastplayervector = new Vector3(_manager._lastPlayerTransform.position.x, transform.position.y, _manager._lastPlayerTransform.position.z);
                isRecognition    = true;
            }
            if (!_manager.isAlertPatrol)
            {
                _manager._UIs[2].fillAmount = _time / 0.67f;
                if (_time >= ReconCapture)
                {
                    _manager.SetState(MP01State.CWATCH);
                    _manager.SightLight[1].SetActive(false);
                    _manager.SightLight[2].SetActive(true);
                    return;
                }
            }
            if (_manager.isAlertPatrol)
            {
                _manager._UIs[2].fillAmount = _time * 2f;
                if (_time >= GuardCapture)
                {
                    _manager.SetState(MP01State.CWATCH);
                    _manager.SightLight[1].SetActive(false);
                    _manager.SightLight[2].SetActive(true);
                    _manager.isAlert = false;
                    return;
                }
            }
        }
        if (_manager._UIs[2].fillAmount >= 1)
        {
            _manager._UIs[2].fillAmount = 1;
        }
        if (_manager._UIs[2].fillAmount <= 0)
        {
            _manager._UIs[2].fillAmount = 0;
        }
    }
Пример #8
0
    private void Update()
    {
        timer += Time.deltaTime;

        if (timer >= waitTime)
        {
            alert.isVector3 = true;
            _manager.SetState(MP01State.ALERT);
            timer = 0;
            return;
        }

        if (GameLib.DetectCharacter2(_manager.Sight, _manager.PlayerCS))
        {
            _manager.isAlertPatrol = true;
            _manager.SetState(MP01State.WATCH);
            return;
        }
    }
Пример #9
0
    private void Update()
    {
        if (GameLib.DetectCharacter2(_manager.Sight, _manager.PlayerCS))
        {
            _manager.SetState(DroneState.CHASE);
            return;
        }

        _time += Time.deltaTime;
        if (_time > _idleTime)
        {
            _manager.SetState(DroneState.PATROL);
            _manager._patrolcount++;
            _time = 0;
        }
        if (_manager._patrolcount >= 10)
        {
            _manager._patrolcount = 1;
        }
    }
Пример #10
0
    private void Update()
    {
        _time += Time.deltaTime;
        _manager._UIs[2].fillAmount = 1 - (_time / 15f);
        //1초 동안 플레이어 도망갈 시간 줌.
        if (!last1)
        {
            _manager.agent.destination = playerTrans;
            _manager.agent.isStopped   = false;
            //_manager.CC.CKMove(playerTrans, _manager.Stat);
            //transform.LookAt(playerTrans);
            //UI.setactive(true);
            if (_time >= UITime)
            {
                //UI.setactive(false);
                _manager.Emotion2.SetActive(false);
                last1    = true;
                playerT1 = new Vector3(_manager.PlayerTransform.position.x, transform.position.y, _manager.PlayerTransform.position.z);
            }
        }
        // playerT1 -> playerT2로 이동
        if (last1 && !last2)
        {
            _manager.agent.destination = playerT1;
            _manager.agent.isStopped   = false;
            //_manager.CC.CKMove(playerT1, _manager.Stat);
            //transform.LookAt(playerT1);
            if (Vector3.Distance(playerT1, transform.position) < 1f)
            {
                last2    = true;
                playerT2 = new Vector3(_manager.PlayerTransform.position.x, transform.position.y, _manager.PlayerTransform.position.z);
            }
        }
        // playerT2의 정보를 가져오기 위한 bool 값
        if (last2)
        {
            float _timer   = 0;
            float MoveTime = 5f;
            _timer += Time.deltaTime;

            //5초 동안만 이동
            if (_timer <= MoveTime)
            {
                _manager.agent.destination = playerT2;
                _manager.agent.isStopped   = false;
                //_manager.CC.CKMove(playerT2, _manager.Stat);
                //transform.LookAt(playerT2);
            }
        }


        // 1초 시간 준 후에 시야에 발각되면 Attack으로 보내줌. attack에서는 체력-1시키는거와 체크포인트로 이동시키는걸 함. 그리고 다시 경계모드로 돌아감.
        if (GameLib.DetectCharacter2(_manager.Sight, _manager.PlayerCS))
        {
            _manager.SetState(MP01State.ATTACK);
            return;
        }

        if (_time >= ChaseTime)
        {
            _manager.SetState(MP01State.ALERT);
            _manager.SightLight[2].SetActive(false);
        }
        //3초간 ! UI 출력

        //3초간 거리와 상관없이 인식
        //유저에게 이동 = _manager.CKMove(_manager.PlayerTransform.position, _manager.Stat);

        // 범위 안에 적이 존재 할 시 HP-- 시킴.
        // 아니면 거리 인식 종료 및 그 위치 저장.
        // Chase 시작 할 때 위치로 이동
        // 하다가 시간 되면 경계모드로 변경
    }
Пример #11
0
    private void Update() {
        
        _UItime += Time.deltaTime;
        if (_UItime >= UITime) {
          //  _manager.Emotion1.SetActive(false);
        }
        _guardTime += Time.deltaTime;
        if (_guardTime >= GuardTime) {
            _manager.SetState(MP01State.PATROL);
            _manager.isAlert = false;
            _guardTime = 0;
            return;
        }
        if (!isPlayer)
        {
            _manager.agent.destination = lastPlayerVector;
            _manager.agent.stoppingDistance = 0.3f;
            _manager.agent.isStopped = false;
            //_manager.CC.CKMove(lastPlayerVector, _manager.Stat);
            //transform.LookAt(lastPlayerVector);
        }
        if (isVector3)
        {
            _manager.agent.destination = lastTrans;
            _manager.agent.isStopped = false;
            //_manager.CC.CKMove(lastTrans, _manager.Stat);
            //transform.LookAt(lastTrans);
            if (Vector3.Distance(lastTrans, transform.position) < 0.3f && !_manager.isAlertPatrol)
            {
                _manager.isAlertPatrol = true;
                _manager.SetState(MP01State.PATROL);
                return;
            }
        }
        if (GameLib.DetectCharacter2(_manager.Sight, _manager.PlayerCS)){
            _manager.isAlertPatrol = true;
            _manager.SetState(MP01State.WATCH);
            return;
        }

        if (Vector3.Distance(lastPlayerVector, transform.position) < 0.54f && !isVector3) {
            _manager.SetState(MP01State.LOSTTARGET);
            isPlayer = true;
            return;
            //if (isPlayer)
            //{                
            //    timer += Time.deltaTime;
            //    if (timer > waitTime)
            //    {
            //        isVector3 = true;                   
            //    }
            //}            
        }
        _manager._UIs[2].fillAmount = _manager._UIs[2].fillAmount - (_UItime / 50f);
        if (_manager._UIs[2].fillAmount >= 1)
        {
            _manager._UIs[2].fillAmount = 1;
        }
        if (_manager._UIs[2].fillAmount <= 0)
        {
            _manager._UIs[2].fillAmount = 0;
        }
    }