Inheritance: MonoBehaviour
    private void ConstructLevel(int index)
    {
        StopAllCoroutines();

        StopCoroutine(Restart());
        var levelModel = Instantiate(levelInvironmentPrefabs[index]);

        tower          = FindObjectOfType <Tower>();
        towerRotator   = FindObjectOfType <TowerRotator>();
        gun            = FindObjectOfType <Gun>();
        ammo           = FindObjectOfType <Ammo>();
        box            = FindObjectOfType <BoxHandler>();
        cannonBallText = FindObjectOfType <CannonBallCountText>();
        brick          = FindObjectOfType <BrickBehavior>();

        tower.Init();
        towerRotator.Init();
        gun.Init();
        ringCounter++;
        box.Init();
        cannonBallText.Init();

        rings          = tower.rings;
        prevLevelModel = levelModel;
        StartCoroutine(CountBull());
        timer     = (timeForOneRing - (timeForOneRing * ringCounter * 2 / timeForOneRing)) * ringCounter;
        startTime = timer;
        UIHandler.Instance.Init();
    }
Example #2
0
    void MakeRing(int ringCount)
    {
        float radius = baseRadius + ringDepth * level;

        for (int n = 0; n < numBricks; n++)
        {
            double        start = angle * n;
            string        id    = ringCount + "." + n;
            BrickBehavior brick = new BrickBehavior(id, radius, start, start + angle);
        }
    }
Example #3
0
    public List <BrickBehavior> InitBrick(int brickCount)
    {
        List <BrickBehavior> bricksList = new List <BrickBehavior>();
        BrickBehavior        brick      = new BrickBehavior();

        for (int i = 0; i < brickCount; i++)
        {
            bricksList.Add(brick);
        }
        return(bricksList);
    }
 // Use this for initialization
 void Awake()
 {
     main = this;
     rend = GetComponent <Renderer> ();
     rend.enabled = true;
     brickColl =rend.material;//new Material (Shader.Find("brick"));
     brickColl.color = new Color32((byte)(cR * durability), (byte)(cG* durability),(byte)(cB* durability), (byte)(cA));
     curentCollor = brickColl.color;
     uperBound = (float)(transform.position.y + (transform.localScale.y * .5));
     lowerBound = (float)(transform.position.y - (transform.localScale.y * .5));
     leftBound = (float)(transform.position.x - (transform.localScale.x * .5));
     rightBound = (float)(transform.position.x + (transform.localScale.x * .5));
     //	Debug.Log (curentCollor.r );
 }
Example #5
0
 void InstantiateTest()
 {
     if (testBrick)
     {
         Destroy(testBrick);
     }
     else
     {
     }
     testBrick = Instantiate(selectedBrick);
     testBrick.GetComponent <MeshRenderer>().material = testMat;
     testBrick.GetComponent <Collider>().enabled      = false;
     testBrick.transform.position = transform.position + transform.forward * maxDistance;
     bh        = testBrick.GetComponent <BrickBehavior>();
     testMR    = testBrick.GetComponent <MeshRenderer>();
     brickInfo = testBrick.GetComponent <BrickInfo>();
 }
Example #6
0
 private void OnEnable()
 {
     myScript = (BrickBehavior)target;
 }