예제 #1
0
 internal void setTarget(Transform t)
 {
     target = t;
     if (t != null)
     {
         targetCS = t.GetComponent <biologyCS>();
     }
 }
예제 #2
0
    float seeMax, bais = Mathf.Floor(UnityEngine.Random.Range(0.8f, 1.6f)); //-4~6

    public gameBits(biologyCS parent)
    {
        DrawCircle  = parent.GetComponent <DrawCircle>();
        actionIsOn  = false;
        allBiologys = parent.allBiologys;
        bioCamp     = parent.getBioCamp();
        leaderName  = parent.getleaderNumber();
        seeMax      = parent.getSeeMax();
        Transform   = parent.getTransform();
        this.parent = parent;


        //todo:之後要各生物儲存
        decideList.Add("decideHpUnder90percentAlly");
        actionList.Add("actionHeal");
        decideList.Add("decideClosestEnemy");
        actionList.Add("actionAttack");
    }
예제 #3
0
    void keepDistWithFrontBio(float n)
    {
        //以生物的的正前方射出一條線
        Ray ray = new Ray();

        ray.origin    = this.transform.position + new Vector3(0, 1, 0);
        ray.direction = Sphere2 - this.transform.position;

        //取得射線擊中的物件
        RaycastHit rayHit;

        if (Physics.Raycast(ray, out rayHit, n) &&
            rayHit.transform.tag == "Player")
        {
            biologyCS rayHitBioCS = rayHit.transform.gameObject.GetComponent <biologyCS>();

            if (Vector3.Distance(rayHitBioCS.transform.position, this.transform.position) < 1.5f)
            {
                Debug.Log("stopShake");
                bioStop();
            }
        }
    }
예제 #4
0
    void setBio()
    { //將所有生物套上biologyCS;
        var tempAll = GameObject.FindGameObjectsWithTag("biology");

        foreach (GameObject thisBiology in tempAll)
        {
            biologyCS temp = new biologyCS();
            thisBiology.AddComponent <biologyCS>();
            allBiologys.Add(thisBiology);
        }

        tempAll = GameObject.FindGameObjectsWithTag("Player");
        foreach (GameObject thisBiology in tempAll)
        {
            biologyCS temp = new biologyCS();
            thisBiology.AddComponent <biologyCS>();
            addPlayerBioList(thisBiology.GetComponent <biologyCS>());
            allBiologys.Add(thisBiology);
        }

        TextAsset json = Resources.Load("db/biologyList", typeof(TextAsset)) as TextAsset;

        biologyList = JsonUtility.FromJson <biologyList>(json.text);
    }
예제 #5
0
 void addPlayerBioList(biologyCS n)
 {
     playerBioCSList.Add(n);
 }