Пример #1
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         famistate = _famistate.idle;
         chooseapointtogo();
     }
 }
Пример #2
0
 private void OnTriggerStay2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         StopCoroutine(iwanttodo);
         famistate = _famistate.chaseing;
     }
 }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        transform.position = new Vector3(
            player.position.x + Random.insideUnitCircle.x * 10,
            -(player.position.y + Random.insideUnitCircle.y * 10),
            0
            );

        famistate = _famistate.idle;
        chooseapointtogo();

        //shoot!!!
        InvokeRepeating("shootthings", shootdelay, shootdelay);
    }
Пример #4
0
    IEnumerator _choosewhatiwanttodo()
    {
        iamthinking = true;

        //choose one
        int randomchooseone = Random.Range(0, 4);

        switch (randomchooseone)
        {
        case 0:
            famistate = _famistate.idle;

            break;

        case 1:
        case 2:
        case 3:
            famistate = _famistate.lookaround;

            tagretpoint   = new Vector3(0, 0, 0) + Random.insideUnitSphere * 15;
            tagretpoint.z = 0;

            //transform.GetComponent<Rigidbody2D>().AddForce(Random.insideUnitSphere * 100, ForceMode2D.Force);

            break;

        default:
            famistate = _famistate.idle;

            break;
        }

        yield return(new WaitForSeconds(Random.Range(1f, maxthinkingtime)));

        iamthinking = false;

        //run again!
        chooseapointtogo();
    }