예제 #1
0
    public void OnExit()
    {
        m_fightState.enabled     = false;
        m_wanderSteering.enabled = false;

        m_currentState = EStates.INITIAL;
    }
예제 #2
0
    public void Update()
    {
        switch (m_currentState)
        {
        case EStates.INITIAL:
            m_nextState = EStates.WANDER;
            ChangeState();
            break;

        case EStates.WANDER:

            if (!MathExtent.IsInRange(Vector3.Distance(this.transform.position, m_blackboard.m_player.position), m_blackboard.m_alertRadius))
            {
                m_nextState = EStates.FIGHT;
                ChangeState();
            }
            break;

        case EStates.FIGHT:

            if (MathExtent.IsInRange(Vector3.Distance(this.transform.position, m_blackboard.m_player.position), m_blackboard.m_alertRadius))
            {
                m_nextState = EStates.WANDER;
                ChangeState();
            }
            break;
        }
    }
예제 #3
0
        private Rectangle[,] CreateField()
        {
            Rectangle[,] TmpRect = new Rectangle[Width, Height];
            bool[,] TmpLocks     = new bool[Width, Height];
            EStates[,] TmpStates = new EStates[Width, Height];
            OffsetH = (PanelWidth - ((Width * Size) + (Width - 1))) / 3;
            OffsetV = (PanelHeight - ((Height * Size) + (Height - 1))) / 3;

            for (int m = 0; m < Width; m++)
            {
                for (int n = 0; n < Height; n++)
                {
                    TmpRect[m, n]  = new Rectangle(new Point(OffsetH + (m * (Size + 1)), OffsetV + (n * (Size + 1))), new Size(Size, Size));
                    TmpLocks[m, n] = false;
                    if (m == 0 || m == Width - 1 || n == 0 || n == Height - 1)
                    {
                        TmpStates[m, n] = EStates.WallPlaced;
                    }
                    else
                    {
                        TmpStates[m, n] = EStates.FreeSpace;
                    }
                }
            }
            State = TmpStates;
            Lock  = TmpLocks;
            return(TmpRect);
        }
예제 #4
0
    public void Update()
    {
        switch (m_currentState)
        {
        case EStates.INITIAL:

            m_nextState = EStates.COMPANION_FIGHT;
            ChangeState();
            break;

        case EStates.COMPANION_FIGHT:

            if (m_blackboard.m_companion == null || m_blackboard.m_companion.Equals(null))
            {
                m_nextState = EStates.SOLO_FIGHT;
                ChangeState();
                break;
            }
            break;

        case EStates.SOLO_FIGHT:

            if (m_blackboard.m_companion != null && !m_blackboard.m_companion.Equals(null))
            {
                m_nextState = EStates.COMPANION_FIGHT;
                ChangeState();
                break;
            }
            break;
        }
    }
예제 #5
0
        public bool SetState(EStates state)
        {
            uint lastErrorCode = 0;

            var result = VcsWrapper.Device.VcsSetState(KeyHandle, NodeId, state, ref lastErrorCode) > 0;

            LastErrorCode = lastErrorCode;

            return(result);
        }
 public CreateAddressCommand(string cep, EStates state, string city, string street, int number, EAddressType type, Guid idPerson, string description = null)
 {
     this.IdPerson = idPerson;
     this.CEP = cep;
     this.State = state;
     this.City = city;
     this.Street = street;
     this.Number = number;
     this.Type = type;
     this.Description = description;
 }
 public CreateAddressCommand(string cep, EStates state, string city, string street, int number, EAddressType type, Guid idPerson, string description = null)
 {
     this.IdPerson    = idPerson;
     this.CEP         = cep;
     this.State       = state;
     this.City        = city;
     this.Street      = street;
     this.Number      = number;
     this.Type        = type;
     this.Description = description;
 }
예제 #8
0
    public void Awake()
    {
        m_currentState = EStates.INITIAL;

        m_blackboard     = GetComponent <LaserEnemyBlackboard>();
        m_companionFight = GetComponent <CompanionFightFSM>();
        m_soloFight      = GetComponent <SoloFightFSM>();

        m_companionFight.enabled = false;
        m_soloFight.enabled      = false;
    }
 public ChangeAddressCommand(Guid Id, string cep, EStates state, string city, string street, int number, EAddressType type, string description = null)
 {
     this.Id          = Id;
     this.CEP         = cep;
     this.State       = state;
     this.City        = city;
     this.Street      = street;
     this.Number      = number;
     this.Type        = type;
     this.Description = description;
 }
예제 #10
0
    public void Awake()
    {
        m_blackboard     = GetComponent <LaserEnemyBlackboard>();
        m_fightState     = GetComponent <FightFSM>();
        m_wanderSteering = GetComponent <WanderAroundPlusAvoid>();

        m_fightState.enabled     = false;
        m_wanderSteering.enabled = false;

        m_currentState = EStates.INITIAL;
    }
 public ChangeAddressCommand(Guid Id, string cep, EStates state, string city, string street, int number, EAddressType type, string description = null)
 {
     this.Id = Id;
     this.CEP = cep;
     this.State = state;
     this.City = city;
     this.Street = street;
     this.Number = number;
     this.Type = type;
     this.Description = description;
 }
예제 #12
0
 /// <summary>
 /// Gets the state object
 /// </summary>
 /// <param name="state">Enum value of state</param>
 /// <returns>State object</returns>
 private IState GetCurrentState(EStates state)
 {
     switch(state)
     {
         case EStates.CARDDRAWN:
             return cardDrewState;
         case EStates.DECKISEMPTY:
             return deckIsEmptyState;
         case EStates.DECKISSHUFFLED:
             return deckShuffledState;
         case EStates.RESET:
             return resetState;
         default:
             return null;
     }
 }
예제 #13
0
        public override bool Execute(string source)
        {
            bool    result     = false;
            var     eposDevice = Device as EposDevice;
            EStates state      = EStates.StDisabled;

            var deviceCommunication = eposDevice?.Communication;

            if (deviceCommunication is Epos4DeviceCommunication communication)
            {
                var commandResult = communication.GetState(ref state);

                SetParameterValue("State", (ushort)state);
                SetParameterValue("ErrorCode", communication.LastErrorCode);
                SetParameterValue("Result", commandResult);

                result = true;
            }

            return(result);
        }
예제 #14
0
        public Address(string street, int number, string neighborhood, string city, string stateName, string coutry, string zipCode, EStates abbr)
        {
            Street       = street;
            Number       = number;
            Neighborhood = neighborhood;
            City         = city;
            StateName    = stateName;
            Country      = coutry;
            ZipCode      = zipCode;
            Abbr         = abbr;

            AddNotifications(new Contract()
                             .Requires()
                             //Validações sobre a rua
                             .IsNotNullOrEmpty(Street, "Street", SharedMessages.InvalidStreet)
                             .HasMinLen(Street, 3, "Street", string.Format(SharedMessages.MinLength, "Rua", 3))
                             .HasMaxLen(Street, 50, "Street", string.Format(SharedMessages.MaxLength, "Rua", 50))
                             //Validações sobre o bairro
                             .IsNotNullOrEmpty(Neighborhood, "Neighborhood", SharedMessages.InvalidNeighborhood)
                             .HasMinLen(Neighborhood, 3, "Neighborhood", string.Format(SharedMessages.MinLength, "Bairro", 3))
                             .HasMaxLen(Neighborhood, 50, "Neighborhood", string.Format(SharedMessages.MaxLength, "Bairro", 50))
                             //validações sobre a cidade
                             .IsNotNullOrEmpty(City, "City", SharedMessages.InvalidNeighborhood)
                             .HasMinLen(City, 3, "City", string.Format(SharedMessages.MinLength, "Cidade", 3))
                             .HasMaxLen(City, 50, "City", string.Format(SharedMessages.MaxLength, "Cidade", 50))
                             //validações do país
                             .IsNotNullOrEmpty(Country, "Coutry", SharedMessages.InvalidNeighborhood)
                             .HasMinLen(Country, 3, "Coutry", string.Format(SharedMessages.MinLength, "País", 3))
                             .HasMaxLen(Country, 50, "Coutry", string.Format(SharedMessages.MaxLength, "País", 50))
                             //validações do CEP
                             .IsNotNullOrEmpty(ZipCode, "ZipCode", SharedMessages.InvalidNeighborhood)
                             .IsTrue(CepValidation.ValidaCEP(ZipCode), "ZipCode", SharedMessages.InvalidZipCode)
                             //Validações do estado
                             .IsNotNullOrEmpty(StateName, "Name", SharedMessages.InvalidState)
                             .HasMinLen(StateName, 3, "Name", string.Format(SharedMessages.MinLength, "Nome do Estado", 3))
                             .HasMaxLen(StateName, 50, "Name", string.Format(SharedMessages.MaxLength, "Nome do Estado", 50))
                             );
        }
예제 #15
0
    public void ChangeState()
    {
        //Exit
        switch (m_currentState)
        {
        case EStates.INITIAL:
            break;

        case EStates.COMPANION_FIGHT:
            m_companionFight.OnExit();
            m_companionFight.enabled = false;
            break;

        case EStates.SOLO_FIGHT:
            m_soloFight.OnExit();
            m_soloFight.enabled = false;
            break;
        }

        //Enter
        switch (m_nextState)
        {
        case EStates.INITIAL:
            break;

        case EStates.COMPANION_FIGHT:
            m_companionFight.enabled = true;
            m_companionFight.OnEnter();
            break;

        case EStates.SOLO_FIGHT:
            m_soloFight.enabled = true;
            m_soloFight.OnEnter();
            break;
        }

        m_currentState = m_nextState;
    }
예제 #16
0
    public void ChangeState()
    {
        //Exit
        switch (m_currentState)
        {
        case EStates.INITIAL:
            break;

        case EStates.WANDER:
            m_wanderSteering.enabled = false;
            break;

        case EStates.FIGHT:
            m_fightState.OnExit();
            m_fightState.enabled = false;
            break;
        }

        //Enter
        switch (m_nextState)
        {
        case EStates.INITIAL:
            break;

        case EStates.WANDER:
            m_wanderSteering.enabled             = true;
            m_wanderSteering.m_seekInfo.m_target = m_blackboard.m_wanderAnchor;
            break;

        case EStates.FIGHT:
            m_fightState.enabled = true;
            m_fightState.OnEnter();
            break;
        }

        m_currentState = m_nextState;
    }
예제 #17
0
 public static bool ChangeStateScopeIsValid(this Address address, EStates state)
 {
     return AssertionConcern.IsSatisfiedBy(
                     AssertionConcern.AssertArgumentNotNull(state, Errors.InvalidState)
         );
 }
예제 #18
0
 public void SetState(EStates state)
 {
     currentState = state;
     Debug.Log(currentState);
 }
예제 #19
0
 public static bool ChangeStateScopeIsValid(this Address address, EStates state)
 {
     return(AssertionConcern.IsSatisfiedBy(
                AssertionConcern.AssertArgumentNotNull(state, Errors.InvalidState)
                ));
 }
예제 #20
0
        static void Main(string[] args)
        {
            int     position           = 0;
            EStates state              = EStates.eA;
            Dictionary <int, int> tape = new Dictionary <int, int>();
            int checksum = 0;

            tape.Add(0, 0);

            for (int i = 0; i < 12523873; i++)
            {
                switch (state)
                {
                case EStates.eA:
                    if (tape[position] == 0)
                    {
                        tape[position] = 1;
                        position++;
                        state = EStates.eB;
                    }
                    else
                    {
                        tape[position] = 1;
                        position--;
                        state = EStates.eE;
                    }
                    break;

                case EStates.eB:
                    if (tape[position] == 0)
                    {
                        tape[position] = 1;
                        position++;
                        state = EStates.eC;
                    }
                    else
                    {
                        tape[position] = 1;
                        position++;
                        state = EStates.eF;
                    }
                    break;

                case EStates.eC:
                    if (tape[position] == 0)
                    {
                        tape[position] = 1;
                        position--;
                        state = EStates.eD;
                    }
                    else
                    {
                        tape[position] = 0;
                        position++;
                        state = EStates.eB;
                    }
                    break;

                case EStates.eD:
                    if (tape[position] == 0)
                    {
                        tape[position] = 1;
                        position++;
                        state = EStates.eE;
                    }
                    else
                    {
                        tape[position] = 0;
                        position--;
                        state = EStates.eC;
                    }
                    break;

                case EStates.eE:
                    if (tape[position] == 0)
                    {
                        tape[position] = 1;
                        position--;
                        state = EStates.eA;
                    }
                    else
                    {
                        tape[position] = 0;
                        position++;
                        state = EStates.eD;
                    }
                    break;

                case EStates.eF:
                    if (tape[position] == 0)
                    {
                        tape[position] = 1;
                        position++;
                        state = EStates.eA;
                    }
                    else
                    {
                        tape[position] = 1;
                        position++;
                        state = EStates.eC;
                    }
                    break;
                }
                if (!tape.ContainsKey(position))
                {
                    tape.Add(position, 0);
                }
            }

            foreach (int v in tape.Values)
            {
                checksum += v;
            }

            Console.WriteLine(string.Format("Diagnostics checksum: {0}", checksum));
            Console.ReadLine();
        }
예제 #21
0
 public void OnEnter()
 {
     m_currentState           = EStates.INITIAL;
     m_companionFight.enabled = false;
     m_soloFight.enabled      = false;
 }