Exemplo n.º 1
0
    void InitPasswordLock()
    {
        List <LostSectorPortal> solutionPortals = new List <LostSectorPortal>();

        foreach (IndexDirection2.DirectionEnum d in _solution)
        {
            IndexDirection2  dir    = IndexDirection2.FromDirectionEnum(d);
            LostSectorPortal portal = DirectionToPortal(dir);
            solutionPortals.Add(portal);
        }
        _passwordLock = new PasswordLock(solutionPortals.ToArray());

        _passwordLock.CorrectEntryCallback           += OnCorrectEntryAddedToSequence;
        _passwordLock.IncorrectEntryCallback         += OnIncorrectEntryAddedToSequence;
        _passwordLock.CorrectPasswordEnteredCallback += OnSequenceCompleted;
    }
Exemplo n.º 2
0
    public void PlayerEnteredPortal(LostSectorPortal portal)
    {
        if (portal == _entrance)
        {
            if (!_hasEnteredLostSector)
            {
                OnEnteredLostSector();
            }
            return;
        }

        if (!_hasEnteredLostSector || HasSolutionSequenceBeenCompleted)
        {
            return;
        }

        AddEntryToSequence(portal);
        if (HasSolutionSequenceBeenCompleted)
        {
            return;
        }

        if (portal == _escapeExit)
        {
            OnExitedLostSector();
        }
        else if (portal == _rightPortal)
        {
            WarpObjects(_warpedObjects, new Vector3(-_sectorWidth, 0, 0));
        }
        else if (portal == _leftPortal)
        {
            WarpObjects(_warpedObjects, new Vector3(_sectorWidth, 0, 0));
        }
        else if (portal == _upPortal)
        {
            WarpObjects(_warpedObjects, new Vector3(0, 0, -_sectorHeight));
        }
        else if (portal == _downPortal)
        {
            WarpObjects(_warpedObjects, new Vector3(0, 0, _sectorHeight));
        }
    }
Exemplo n.º 3
0
 void AddEntryToSequence(LostSectorPortal entry)
 {
     _passwordLock.InputNextEntry(entry);
 }
Exemplo n.º 4
0
 IndexDirection2 PortalToDirection(LostSectorPortal portal)
 {
     return(_directionToPortal.FirstOrDefault(p => p.Value == portal).Key);
 }