Ejemplo n.º 1
0
    public override void Spread()
    {
        int moveX = 0;
        int moveY = 0;

        if (spreadDirection == Direction.Right)
        {
            moveX = 1;
        }
        else if (spreadDirection == Direction.Left)
        {
            moveX = -1;
        }
        else if (spreadDirection == Direction.Down)
        {
            moveY = 1;
        }
        else if (spreadDirection == Direction.Up)
        {
            moveY = -1;
        }

        Vector2Int trailPos = new Vector2Int(gridPos.x, gridPos.y);

        do
        {
            trailPos.x += moveX;
            trailPos.y += moveY;

            EnergyTrail trail = new EnergyTrail(trailPos, EnType.Laser, spreadDirection, this);
            trails.Add(trail);
        } while (!SlotGrid.IsSlotOccupied(trailPos.x, trailPos.y));

        SlotGrid.AddEnergyTrails(trails);
    }
Ejemplo n.º 2
0
    public void MoveStartPos()
    {
        Vector2Int newGridPosStart = gridPosStart + movement;

        if (!SlotGrid.IsSlotOccupied(newGridPosStart.x, newGridPosStart.y))
        {
            EnergyTrail trail = new EnergyTrail(newGridPosStart, creator.energyType, CalculateDirection(gridPosStart, newGridPosStart), creator);
            path.Enqueue(trail);
            SlotGrid.AddEnergyTrail(trail);
            gridPosStart.Set(newGridPosStart.x, newGridPosStart.y);
        }
    }