Exemplo n.º 1
0
 private void Crash()
 {
     remainingMovement  = 0;
     currentField       = startField;
     transform.position = startField.gameObject.transform.position;
     currentSection     = currentField.GetComponentInParent <scr_Section>();
 }
Exemplo n.º 2
0
    private List <scr_Field> PossibleFieldsChangeSection()
    {
        List <scr_Field> Fields  = new List <scr_Field>();
        scr_Section      nextSec = currentSection.nextSection;

        //Add the next field in middle lane
        scr_Field tempField = nextSec.lanes[currentField.lane].fields[0];

        if (LegitimateMove(tempField))
        {
            tempField.isPossible = true;
            Fields.Add(tempField);
        }

        //Add the next field in the lane to the right
        if (currentSection.rule == scr_Section.LaneShiftRules.both || currentSection.rule == scr_Section.LaneShiftRules.moveRight)
        {
            if (currentField.lane > 0)
            {
                tempField = nextSec.lanes[currentField.lane - 1].fields[0];
                if (LegitimateMove(tempField))
                {
                    tempField.isPossible = true;
                    Fields.Add(tempField);
                }
            }
        }

        //Add the next field in left lane
        if (currentSection.rule == scr_Section.LaneShiftRules.both || currentSection.rule == scr_Section.LaneShiftRules.moveLeft)
        {
            if (currentField.lane < currentSection.lanes.Count - 1)
            {
                tempField = nextSec.lanes[currentField.lane + 1].fields[0];
                if (LegitimateMove(tempField))
                {
                    tempField.isPossible = true;
                    Fields.Add(tempField);
                }
            }
        }

        currentSection        = nextSec;
        sectionStoppedCounter = 0;
        return(Fields);
    }