예제 #1
0
    public string DoJudge(SimpleAI sAI)
    {
        float    maxdis = 3.0f;
        SimpleAI gALL   = SimpleAISetSingleton.getInstance().GetComponent <SimpleAISet> ().FindWithRiaus(sAI.mAIRT.transform.position, maxdis, 1 << LayerMask.NameToLayer("Default"), "White");

        //	sAI.GetComponent<BlackComponent> ().firWhite = gALL;
        sAI.GetComponent <WhiteComponent> ().timer1 += Time.deltaTime;
        if (sAI.GetComponent <WhiteComponent> ().timer1 >= 15.0f)
        {
            if (gALL != null)
            {
                sAI.GetComponent <WhiteComponent> ().timer1   = 0.0f;
                sAI.GetComponent <WhiteComponent> ().firWhite = gALL;
                return("Generate");
            }
            else
            {
                return("Run");
            }
        }
        else
        {
            return("Run");
        }
    }
예제 #2
0
 public void DoRun(SimpleAI sAI, string code)
 {
     if (code == "Attack")
     {
         sAI.GetComponent <BlackComponent> ().timer1 = 0.0f;
         if (sAI.GetComponent <BlackComponent> ().firWhite != null)
         {
             SimpleAISetSingleton.getInstance().GetComponent <SimpleAISet> ().Delete(sAI.GetComponent <BlackComponent> ().firWhite);
         }
     }
     else
     {
         if (sAI.GetComponent <BlackComponent> ().timer2 >= 7.0f)
         {
             sAI.GetComponent <BlackComponent> ().timer2 = 0.0f;
             sAI.GetComponent <BlackComponent> ().target = sAI.GeneratePos + new Vector3(Random.Range(-15, 15), 0, Random.Range(-15, 15));
         }
         else
         {
             sAI.GetComponent <BlackComponent> ().timer2 += Time.deltaTime;
         }
         sAI.GetComponent <AIMove> ().mDirection = sAI.GetComponent <BlackComponent> ().target - sAI.mAIRT.transform.position;
         sAI.GetComponent <AIMove> ().mVelocity  = 5.0f;
     }
 }
예제 #3
0
    public SimpleAI FindAIByRayCast(string tag)
    {
        Vector3    ScreenPoint = Input.mousePosition;
        Ray        myRay       = Camera.main.ScreenPointToRay(ScreenPoint);
        RaycastHit hit;

        if (Physics.Raycast(myRay, out hit, 100.0f, 1 << LayerMask.NameToLayer("Default")))
        {
            if (hit.collider.tag == tag)
            {
                SimpleAI my = SimpleAISetSingleton.getInstance().GetComponent <SimpleAISet> ().FindByGameObject(hit.collider.gameObject);
                return(my);
            }
        }
        return(null);
    }