Beispiel #1
0
    public void MakeBlinker()
    {
        _Mono blinker = Utils.InstanceCreate(AngleToBlinkerLocation(initialAngle), blinkerPrefab);

        blinker.spriteRenderer.sprite = blinkerSprite;
        blinker.angle = initialAngle + 180f;
    }
Beispiel #2
0
    private int comboCount      = 0; // -1 means combo has been stopped;

    // Update is called once per frame
    void Update()
    {
        /*
         * bool destroyed = false;
         * if(startedTracking){
         *  Debug.Log(bugs.Length);
         *  while( (bugs[currentIndex - 1] == null || bugs[currentIndex - 1].Equals(null))
         *        && currentIndex != bugs.Length + 1){
         *      if(currentIndex < bugs.Length){currentIndex += 1;}
         *      else{
         *          Destroy(gameObject);
         *          currentIndex = bugs.Length + 1;
         *          Debug.Log("CCS destroyed");
         *      }
         *  }
         *
         *  if(!destroyed){
         */
        if (startedTracking)
        {
            _Mono bug = bugs[currentIndex];
            xy    = bug.xy;
            xys   = bug.xys * (comboCount == -1 ? 0f : 2.4f);
            angle = bug.angle;
            alpha = bug.alpha * 0.5f;
        }

        /*    }
         * }*/
    }
Beispiel #3
0
    public void MakeSpecialEffect()
    {
        //Debug.LogWarning("creating golden leaf");
        _Mono fx = Object.Instantiate(goldenLeaf, gameObject.transform.position, Quaternion.Euler(transform.eulerAngles)) as _Mono;

        fx.xs = xs * 1.2f;
        fx.ys = ys * 1.2f;
    }
Beispiel #4
0
    protected override void PositionFoilage()
    {
        _Mono foilMono = foilage.GetComponent <_Mono> ();

        foilMono.xy    = GetRootPosition(foilagePosition);
        foilMono.angle = myAngle - 90;
        foilMono.xs    = xs * 3;
        foilMono.ys    = ys;
    }
Beispiel #5
0
    //Recusive
    protected virtual void CreateFoilage()
    {
        if (generation >= foilGen && foilage == null)
        {
            foilage = new GameObject();
            SpriteRenderer sr = foilage.AddComponent <SpriteRenderer> ();
            sr.sortingLayerName = "Foilage";
            _Mono foilMono = foilage.AddComponent <_Mono> ();
            sr.sortingOrder = 1;
            foilMono.spriteRenderer.sprite = foilageSprite;
        }

        foreach (TreeModel branch in branches)
        {
            branch.CreateFoilage();
        }
    }
Beispiel #6
0
    //Recusive
    protected virtual void PositionFoilage()
    {
        if (generation == 0)
        {
            foilAccessCounter = 0;
        }

        if (foilage != null)
        {
            _Mono foilMono = foilage.GetComponent <_Mono> ();
            foilMono.xy    = GetRootPosition(foilagePosition);
            foilMono.angle = myAngle - 90;
            foilMono.xs    = ys * 2 * foilageXs;
            foilMono.ys    = ys * foilageYs;

            //THIS NEEDS ONE MORE CHECK
            Globals.HazardColors color = Globals.HazardColors.NONE;
            if (root.foilageColorPool.Count > 0)
            {
                if (foilMono.spriteRenderer.sprite == foilageSprite)
                {
                    Sprite spr = foilageSprite;
                    color = root.foilageColorPool[0];
                    switch (color)
                    {
                    case (Globals.HazardColors.RED): { spr = foilageRed; break; }

                    case (Globals.HazardColors.BLUE): { spr = foilageBlue; break; }

                    case (Globals.HazardColors.YELLOW): { spr = foilageYellow; break; }

                    case (Globals.HazardColors.PURPLE1): { spr = foilagePurple; break; }

                    case (Globals.HazardColors.WHITE): { spr = foilageWhite; break; }
                    }
                    foilMono.spriteRenderer.sprite = spr;
                    root.foilageColorPool.RemoveAt(0);
                }
            }
        }

        foreach (TreeModel branch in branches)
        {
            branch.PositionFoilage();
        }
    }
Beispiel #7
0
    // Use this for initialization
    void Start()
    {
        //cameraHeight = Camera.main.orthographicSize;

        leaves = new List <_Mono>();
        for (int i = 0; i < numLeaves; i++)
        {
            GameObject leaf     = Object.Instantiate(shieldLeafPrefab, Vector3.zero, Quaternion.identity) as GameObject;
            _Mono      leafMono = leaf.GetComponent <_Mono>();
            leaves.Add(leafMono);

            if (isBigLeaf(i))
            {
                leafMono.gameObject.AddComponent <CenterLeafScript>().goldenLeaf = goldenShieldLeafPrefab;
                leafMono.spriteRenderer.sprite = centerLeafSprite;
            }
        }
    }
Beispiel #8
0
    // Update is called once per frame
    public void Show()
    {
        int h = Mathf.FloorToInt(Globals.treeManager.mainTree.totalHeight);

        Debug.Log(Globals.stateManager.currentStage);
        guiTextInstance.text = (Globals.stateManager.currentStage != Globals.STAGE_THREE) ?
                               "Your tree grew to be " + h + " inches tall! \n Score: " +
                               h + "\n Press Enter to Restart." :
                               "Your tree grew to be " + h + " inches tall! \n You grew " + Globals.treeManager.mainTree.numFruits + " fruits!\n Score: " +
                               (h + Globals.treeManager.mainTree.numFruits * 5) + "\n Press Enter to Restart.";


        guiTextMono = guiTextInstance.gameObject.AddComponent <_Mono>();
        guiTextMono.guiTextAlpha = 0f;
        //Sequence sq = DOTween.Sequence();
        DOTween.To(() => guiAlpha, x => guiAlpha = x, targetAlpha, 1f);
        DOTween.To(() => guiTextMono.guiTextAlpha, x => guiTextMono.guiTextAlpha = x, 1f, 1f);
        //sq.AppendCallback(ShowGuiText);
    }
Beispiel #9
0
    public void setAlphaRecursive(float a)
    {
        alpha = a;

        if (foilage != null)
        {
            _Mono foilMono = foilage.GetComponent <_Mono> ();
            foilMono.alpha = a * 1.5f;
        }


        foreach (FruitScript f in fruits)
        {
            f.alpha = a * 1.5f;
        }

        foreach (TreeModel branch in branches)
        {
            branch.setAlphaRecursive(a);
        }
    }
Beispiel #10
0
 public override void Start()
 {
     base.Start();
     chair = transform.GetChild(0).gameObject.AddComponent<_Mono>();
 }
Beispiel #11
0
    public static _Mono InstanceCreate(float x, float y, float z, _Mono prefab)
    {
        GameObject go = GameObject.Instantiate(prefab.gameObject, new Vector3(x, y, z), Quaternion.identity) as GameObject;

        return(go.AddComponent <_Mono>());
    }
Beispiel #12
0
 public static _Mono InstanceCreate(float x, float y, _Mono prefab)
 {
     return(InstanceCreate(x, y, 0, prefab));
 }
Beispiel #13
0
 public static _Mono InstanceCreate(Vector2 xy, _Mono prefab)
 {
     return(InstanceCreate(xy.x, xy.y, prefab));
 }
Beispiel #14
0
 public static bool IsDestroyed(_Mono o)
 {
     return(o == null || o.Equals(null));
 }
Beispiel #15
0
 public override void Start()
 {
     base.Start();
     chair = transform.GetChild(0).gameObject.AddComponent <_Mono>();
 }