Esempio n. 1
0
    //once a shrine has been exhausted, destroy it and dissasociate it from all ascend lights
    public override void Exhausted()
    {
        Tile[] t = u.CurrentTile._adjacentTiles;

        for (int i = 0; i < t.Length; i++)
        {
            if (!t[i])
            {
                continue;
            }
            AscendLight al = (AscendLight)t[i].GetComponentInChildren(typeof(AscendLight));
            al.removeShrine(this);

            if (t[i])
            {
                al = (AscendLight)t[i].Above.GetComponentInChildren(typeof(AscendLight));
                if (al)
                {
                    al.removeShrine(this);
                }
            }
        }

        u.CurrentTile.Resident = null;

        Destroy(this.gameObject);
    }
Esempio n. 2
0
    public Unit CreateUnit(Tile t, Unit u, bool explosion)
    {
        Unit g;

        //if there is a unit on the tile
        if (t.Resident != null)
        {
            return(null);
            //if the tile is empty
        }
        else
        {
            //make a new unit at the tile
            g             = (Unit)Instantiate(u);
            g.CurrentTile = t;
            g.SetTile(t);
            g.ClickToTile(t);
            //g.Moved=true;
            g.Player = CurrTurn;

            if (explosion)
            {
                ((GameObject)Instantiate(Resources.Load("Prefabs/TurretBulletExplosion", typeof(GameObject)), g.transform.position, g.transform.rotation)).transform.parent = g.CurrentTile.transform;
            }

            //* Aesthetics for the spawning *//
            t.audio.PlayOneShot(spawnUnitNoise);

            AscendLight al = (AscendLight)((GameObject)Instantiate(Resources.Load("prefabs/AscendLight"))).GetComponent("AscendLight");
            al.setTile(t);
            al.OneShot();
        }

        return(g);
    }
Esempio n. 3
0
    override public void Update()
    {
        //oscillate the glow intensity
        if (glowLight)
        {
            glowLight.intensity += (-glowLight.intensity + .45f) / 15;
        }

        if (run)
        {
            return;
        }

        //if ascendlights have not been created yet, create them on the surrounding tiles
        Tile t = u.CurrentTile;

        for (int i = 0; i < t._adjacentTiles.Length; i++)
        {
            if (!t._adjacentTiles[i] || !t._adjacentTiles[i].Above)
            {
                continue;
            }

            AscendLight al = (AscendLight)t._adjacentTiles[i].GetComponentInChildren(typeof(AscendLight));

            if (al)
            {
                al.attachShrine(this);
                continue;
            }

            //create it on the tiles around the shrine
            al = (AscendLight)((GameObject)Instantiate(Resources.Load("Prefabs/AscendLight"))).GetComponent("AscendLight");
            al.setTile(t._adjacentTiles[i]);
            al.attachShrine(this);

            //create it on the tiles above, as well, if applicable
            if (t._adjacentTiles[i].Above)
            {
                AscendLight al2 = (AscendLight)((GameObject)Instantiate(Resources.Load("Prefabs/AscendLight"))).GetComponent("AscendLight");
                al2.setTile(t._adjacentTiles[i].Above);
                al2.attachShrine(this);

                al.Above = al2;
            }
        }
        run = true;
    }