Exemplo n.º 1
0
    public bool CollaspeNearbyWaveSlot(IntVector3 coord, EPortDirection direction, int portHashCode)
    {
        var coordStart = waveManager.waveSlotGridStartCoordinate;
        var coordEnd   = waveManager.waveSlotGridEndCoordinate;

        var startShift = IntVector3.zero;
        var endShift   = IntVector3.zero;

        switch (direction)
        {
        case EPortDirection.up:
            endShift = IntVector3.down;
            break;

        case EPortDirection.down:
            startShift = IntVector3.up;
            break;

        case EPortDirection.right:
            endShift = IntVector3.left;
            break;

        case EPortDirection.left:
            startShift = IntVector3.right;
            break;

        case EPortDirection.front:
            endShift = IntVector3.back;
            break;

        case EPortDirection.back:
            startShift = IntVector3.front;
            break;
        }
        // Debug.Log("Coord: " + coord);
        // Debug.Log("Start: " + (coordStart + startShift));
        // Debug.Log("End: " + (coordEnd + endShift));

        if (coord.Inside(coordStart + startShift, coordEnd + endShift))
        {
            var dir = IntVector3.zero - startShift - endShift;

            var nearbyCoord = coord + dir;
            // Debug.Log("Nearby: " + nearbyCoord);
            var waveSlot       = waveManager.GetWaveSlotWithCoordinate(nearbyCoord);
            var waveToCollaspe = waveManager.GetWaveHashCodeViaComparedPort(portHashCode);
            waveSlot.MarkToCollaspeWave(waveToCollaspe);
            // waveSlot.CollaspeWave(waveToCollaspe);
        }

        return(false);
    }
Exemplo n.º 2
0
        private string GetDirString(EPortDirection dir)
        {
            switch (dir)
            {
            case EPortDirection.In: return("in");

            case EPortDirection.Out: return("out");

            case EPortDirection.InOut: return("inout");

            default: throw new NotImplementedException();
            }
        }
Exemplo n.º 3
0
 private string GetDirString(EPortDirection dir)
 {
     switch (dir)
     {
         case EPortDirection.In: return "in";
         case EPortDirection.Out: return "out";
         case EPortDirection.InOut: return "inout";
         default: throw new NotImplementedException();
     }
 }