Beispiel #1
0
    public void Notify(LaserMove laser)
    {
        if (TileObject != null)
        {
            var script = TileObject.GetScript<IGridObject>();
            if (script != null)
                script.Strike(laser);
        }

        laser.Move();
    }
Beispiel #2
0
    public void Notify(LaserMove laser)
    {
        if (TileObject != null)
        {
            var script = TileObject.GetScript <IGridObject>();
            if (script != null)
            {
                script.Strike(laser);
            }
        }

        laser.Move();
    }
Beispiel #3
0
    public void Strike(LaserMove laser)
    {
        Destroy(laser.gameObject);

        LaserMove l1 = ((GameObject)Instantiate(laser.gameObject)).GetComponent <LaserMove>();

        l1.Direction = laser.Direction.RotateLeft();
        l1.Colour    = new Color(laser.Colour.r, 0, 0);
        l1.Move();


        LaserMove l2 = ((GameObject)Instantiate(laser.gameObject)).GetComponent <LaserMove>();

        l2.Direction = laser.Direction;
        l2.Colour    = new Color(0, laser.Colour.g, 0);
        l2.Move();


        LaserMove l3 = ((GameObject)Instantiate(laser.gameObject)).GetComponent <LaserMove>();

        l3.Direction = laser.Direction.RotateRight();
        l3.Colour    = new Color(0, 0, laser.Colour.b);
        l3.Move();

        if (GetEnergy(l1) < 0.2f)
        {
            Destroy(l1.gameObject);
        }
        if (GetEnergy(l2) < 0.2f)
        {
            Destroy(l2.gameObject);
        }
        if (GetEnergy(l3) < 0.2f)
        {
            Destroy(l3.gameObject);
        }
    }