Ejemplo n.º 1
0
 public static Monster_Instantiator GetInstance()
 {
     if (instance == null)
     {
         instance = FindObjectOfType <Monster_Instantiator>();
     }
     return(instance);
 }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        Target = PlayerController.GetInstance().Player_target;
        if (Target.position.x > gameObject.transform.position.x)
        {
            lookRight = 1;
        }
        else
        {
            lookRight = -1;
        }

        switch (lookRight)
        {
        case 1:
            theScale.z           = 1;
            transform.localScale = theScale;
            break;

        case -1:
            theScale.z           = -1;
            transform.localScale = theScale;
            break;
        }

        switch (state)
        {
        case State.Idle:
            Idle();
            break;

        case State.Move:
            Move();
            break;

        case State.Attack:
            Attack();
            break;
        }

        //죽음
        if (hp <= 0)
        {
            Monster_Instantiator.GetInstance().ins_cnt -= 1;
            Destroy(gameObject);
        }
    }