Beispiel #1
0
 // Update is called once per frame
 void Update()
 {
     aimZone = scope.GetComponent <Octo_sort>().passZone();
     //target = aimZone.lockon(scope.transform);
     if ((Input.GetKey(KeyCode.Mouse0) || Input.GetKey(KeyCode.Comma)) && pace2 == true)
     {
         StartCoroutine(fire2());
     }
     else if ((Input.GetKeyUp(KeyCode.Mouse0) || Input.GetKeyDown(KeyCode.Comma)) && chargeTimer > 2f && pace2 == true)
     {
         // create a script that fires missles with octo_sort at the given transform
         if (target != null)
         {
             StartCoroutine(fire2());
         }
         else
         {
             target = foward;
             StartCoroutine(fire2());
         }
         target      = null;
         chargeTimer = 0;
     }
     else if ((Input.GetKey(KeyCode.Mouse0) || Input.GetKeyDown(KeyCode.Comma)) && chargeTimer < 2f)
     {
         chargeTimer += Time.deltaTime;
         //Debug.Log("squak");
     }
     if (bulletList.ListSum() <= bulletID)
     {
         bulletID = 0;
     }
 }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        sortList = gameObject.GetComponent <Octo_sort>();


        if (target != null && target.gameObject.activeSelf == true)
        {
            //transform.LookAt(target);
            Vector3 targetDir = target.position - transform.position;
            float   turnstep  = 0.5f * Time.deltaTime;
            Vector3 newDir    = Vector3.RotateTowards(transform.forward, targetDir, turnstep, 0.0F);
            //Debug.DrawRay(transform.position, newDir, Color.red);
            transform.rotation = Quaternion.LookRotation(newDir);
        }
        else if (target == null || !target.gameObject.activeSelf == true)
        {
            Pool   = sortList.passZone();
            target = Pool.lockon(transform);
        }

        if (target == null)
        {
            target = forward;
        }
        transform.position = Vector3.MoveTowards(transform.position, target.position, step);
    }
Beispiel #3
0
 public void CreateLeaves()
 {
     for (int x = 0; x < 2; x++)
     {
         for (int j = 0; j < 2; j++)
         {
             for (int k = 0; k < 2; k++)
             {
                 GameObject leaf = Instantiate(leafs, (transform.position + (new Vector3(x * worldsize / 2, j * worldsize / 2, k * worldsize / 2))), transform.rotation) as GameObject;
                 leaf.SetActive(false);
                 //barcode[(limit - tier) - 1] = count;
                 catagorize sprout = leaf.GetComponent <catagorize>();
                 sprout.setPool(pool);
                 sprout.setID(limit + 1);
                 sprout.updateBar(barcode, limit);
                 sprout.setBar(limit, 0, count);
                 sprout.setStump(branch);
                 RootNode.attach_leaf(List_sorter(leaf.transform.position), sprout);
                 leaf.transform.SetParent(transform);
                 leaf.name = "" + List_sorter(leaf.transform.position);
                 leaf.SetActive(true);
                 Listquad[count] = leaf;
                 leaf_count      = leaf_count + 1;
                 count++;
             }
         }
     }
     count = 0;
 }
Beispiel #4
0
    //public List<catagorize> leafList;
    // Use this for initialization
    void Start()
    {
        Listquad = new GameObject[8];
        boxlimit = (int)Mathf.Pow(2, (limit + 1));
        outBox   = outsideNode.GetComponent <catagorize>();
        if (first)
        {
            dimension = (worldsize / (Mathf.Pow(2f, (limit + 1))));

            leaf_count = 0;
            barcode    = new int[limit + 1];
            tier       = limit;
            if (UpperBranch == null)
            {
                UpperBranch = gameObject;
            }
            root     = new catagorize[(int)Mathf.Pow(8, limit + 1)];
            RootNode = gameObject.GetComponent <octree_07>();
        }
        if (tier > 0)
        {
            CreateBranch();
        }
        else
        {
            CreateLeaves();
        }
    }
Beispiel #5
0
    // Update is called once per frame

    void Update()
    {
        setbound(transform.position);

        /*
         * leafNode = tree_bark.GrabZone(gameObject);
         *
         * if (!leafNode.GetComponent<catagorize>().CheckID(idcode))
         * {
         *  if (List != null)
         *  {
         *      List.Remove_Test(gameObject);
         *  }
         *  List = leafNode.GetComponent<catagorize>();
         *  List.Add_Test(gameObject);
         *  idcode = List.getID();
         * }*/

        headingTo = (x * (total_box * total_box)) + (y * total_box) + z;
        if (headingTo != currentZone)
        {
            currentZone = headingTo;
            if (!gameObject.CompareTag("Moot"))
            {
                remove_Object();
            }
            if (List != tree_bark.get_object(x, y, z))
            {
                List = tree_bark.get_object(x, y, z);
                if (!gameObject.CompareTag("Moot"))
                {
                    List.Add_Test(gameObject);
                }
            }
        }
    }
Beispiel #6
0
    // Use this for initialization
    void Start()
    {
        if (gameObject.CompareTag("Moot"))
        {
        }
        else
        {
            id_numb = Id_Assign.GetComponent <ID_Assigner>().getID(transform);
        }
        tree_bark = tree.GetComponent <octree_07>();
        bounds    = tree_bark.giveDim();

        segments  = tree_bark.giveLim();
        total_box = (int)Mathf.Pow(2, (segments + 1));

        branch = new GameObject[segments + 1];
        idcode = new int[segments + 1];

        setbound(transform.position);
        headingTo   = (x * (total_box * total_box)) + (y * total_box) + z;
        currentZone = (x * (total_box * total_box)) + (y * total_box) + z;;
        List        = tree_bark.get_object(x, y, z);
        List.Add_Test(gameObject);
    }
Beispiel #7
0
 public void attach_leaf(int id, catagorize note)
 {
     root[id] = note;
 }