Esempio n. 1
0
    //police ai를 멈취 위해 마우스 좌클릭을 감지할 때 사용.
    void getMouseButton()
    {
        if (Input.GetMouseButtonDown(0))
        {
            GameObject targetPoliceAI;

            Ray          ray    = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit2D rayHit = Physics2D.Raycast(ray.origin, ray.direction, Mathf.Infinity, LayerMask.GetMask("Police Enemy"));

            if (rayHit.collider != null)//부딪힌 사물이 있다면
            {
                targetPoliceAI = rayHit.collider.gameObject;
                PoliceAI policeScript = targetPoliceAI.GetComponent <PoliceAI>();

                if (policeScript.startChasing)//움직이기 전에 꺼버리면 안되니까 움직이는 것들만 끌수 있게 함.
                {
                    policeScript.powerOff = true;
                    policeScript.policePowerOff();
                }
            }
        }
    }
Esempio n. 2
0
    /*police AI가 추격을 멈추게 하는 함수*/
    void PoliceAiStopChasing(GameObject policeAI)
    {
        PoliceAI policeAIScript = policeAI.GetComponent <PoliceAI>();

        policeAIScript.startChasing = false;
    }
Esempio n. 3
0
 void Start()
 {
     policeAi = gameObject.GetComponent <PoliceAI>();
 }
 void Start()
 {
     animator = GetComponent <Animator>();
     policeAI = GetComponent <PoliceAI>();
 }