コード例 #1
0
ファイル: Vertex.xaml.cs プロジェクト: Raz1el/FSMProject
        public void Init(State state, StateTypes type)
        {
            State = state;
            Type  = type;
            switch (type)
            {
            case StateTypes.Start:
                StartStateElement.Visibility = Visibility.Visible;
                BackgroundEllipse.Fill       = new SolidColorBrush(Colors.DeepSkyBlue);
                break;

            case StateTypes.Final:
                FinalStateElement.Visibility = Visibility.Visible;
                BackgroundEllipse.Fill       = new SolidColorBrush(Colors.SlateBlue);
                break;

            case StateTypes.Normal:
                BackgroundEllipse.Fill = new SolidColorBrush(Colors.SteelBlue);
                break;

            case StateTypes.StartAndFinal:
                BackgroundEllipse.Fill       = new SolidColorBrush(Colors.DeepSkyBlue);
                StartStateElement.Visibility = Visibility.Visible;
                FinalStateElement.Visibility = Visibility.Visible;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            DataLabel.Content = State.ToString();
        }
コード例 #2
0
        public CollectorDialogState T(StateTypes newState)
        {
            switch (newState)
            {
            case StateTypes.stIdle:
                return(CollectorDialogState.IDLE);

            case StateTypes.stGoodBiometric:
                return(CollectorDialogState.GOOD_BIOMETRICS);

            case StateTypes.stBadBiometric:
                return(CollectorDialogState.BAD_BIOMETRICS);

            case StateTypes.stBadBiometricUser:
                return(CollectorDialogState.BAD_BIOMETRICS_USER);

            case StateTypes.stBadUserLoggedIn:
                return(CollectorDialogState.BAD_USER_LOGGED_IN);

            case StateTypes.stShowFileList:
                return(CollectorDialogState.SHOW_FILE_LIST);

            case StateTypes.stNotIdentifiedAsCurrentUser:
                return(CollectorDialogState.NOT_IDENTIFIED_AS_CURRENT_USER);

            default:
                log.Info("Unknown StateTypes state " + newState);
                return(CollectorDialogState.IDLE);
            }
        }
コード例 #3
0
    // When hit something:
    void OnCollisionEnter(Collision collision)
    {
        Vector3 temp = transform.position - collision.gameObject.transform.position;

        temp.Normalize();

        // dot2: 0 means touching with side, +value direct hit
        // dot: 0 means direct hit, +value touching with side:
        float dot2 = Mathf.Abs(Vector3.Dot(transform.forward, temp));
        float dot  = 1 - dot2;

        // Push away from hit rock:
        additionalSpeed = temp * (pushForceMultiplier * movementSpeed * dot2 + pushForceConstant);

        if (state != StateTypes.BeforeLightSpeed && state != StateTypes.LightSpeed && state != StateTypes.Landing && state != StateTypes.Landed)
        {
            state = StateTypes.Bounced;
            timer = stunTime;
        }

        movementSpeed = movementSpeed * dot * 1f;
        //movementSpeed = movementSpeed / 2f;

        if (audioHit != null)
        {
            audioHit.Play();
        }
    }
コード例 #4
0
    public void EnterDockingMode()
    {
        state = StateTypes.Landing;
        timer = 0;

        //enteringLightSpeed = 0;
    }
コード例 #5
0
    void OnChangeGameState(StateTypes type)
    {
        switch (type)
        {
        case StateTypes.WaitingForPlay:
            break;

        case StateTypes.Playing:
            _playerController.StartPlayer();
            break;

        case StateTypes.LevelUp:
            _playerController.LevelUp();
            LevelUp();
            break;

        case StateTypes.Failed:
            ResetLevel();
            CreateTheScene();
            _playerController.PlayerFailed();
            break;

        default:
            break;
        }
    }
コード例 #6
0
ファイル: MissionList.cs プロジェクト: caiodias/EDDiscovery
 public MissionState(MissionState other, StateTypes type)
 {
     Mission = other.Mission;
     sys     = other.sys;
     body    = other.body;
     State   = type;
 }
コード例 #7
0
        /// <summary>
        /// 播放一个动画,默认过渡时间为0.3s,如果在此期间再次播放,则会从头开始
        /// </summary>
        /// <param name="stateTypes"></param>
        /// <param name="fadeDuration">动画过渡时间</param>
        /// <returns></returns>
        public AnimancerState PlayAnimFromStart(StateTypes stateTypes, float fadeDuration = 0.3f, float speed = 1.0f)
        {
            AnimancerState animancerState = AnimancerComponent.CrossFadeFromStart(this.AnimationClips[RuntimeAnimationClips[stateTypes]], fadeDuration);

            animancerState.Speed = speed;
            return(animancerState);
        }
コード例 #8
0
 private void TriggerStateChange(StateTypes state)
 {
     if (OnStateChange != null)
     {
         OnStateChange(state);
     }
 }
コード例 #9
0
    public void EnterLightSpeedMode()
    {
        state = StateTypes.BeforeLightSpeed;
        timer = 0;

        //engineSoundTargetPitch = engineSoundLightSpeed;
        //enteringLightSpeed = 1;
    }
コード例 #10
0
ファイル: MissionList.cs プロジェクト: vasillas/EDDiscovery
 public MissionState(MissionState other, StateTypes type, DateTime?endtime)              // changed to another state..
 {
     Mission        = other.Mission;
     State          = type;
     MissionEndTime = (endtime != null) ? endtime.Value : other.MissionEndTime;
     sys            = other.sys;
     body           = other.body;
 }
コード例 #11
0
        /// <summary>
        /// 处理播放动画
        /// </summary>
        /// <param name="stateTypes">动画对应StateType</param>
        private void HandlePlayAnim(StateTypes stateTypes, float fadeDuration = 0.3f)
        {
            //在播放完成后,每帧都会调用OnEnd委托,由于行为树中的FixedUpdate与Unity的Update频率不一致,所以需要作特殊处理
            m_AnimancerState = this.TheUnitBelongTo.GetComponent <AnimationComponent>()
                               .PlayAnim(stateTypes, fadeDuration);

            m_AnimancerState.OnEnd = this.m_OnAnimFinished;
        }
コード例 #12
0
 public void SetGameState(StateTypes type)
 {
     GameState = type;
     if (OnChangeGameState != null)
     {
         OnChangeGameState(type);
     }
 }
コード例 #13
0
 public MissionState(MissionState other, StateTypes type, DateTime?endtime)            // changed to another state..
 {
     Mission        = other.Mission;
     Redirected     = other.Redirected;      // no completed, since we can't be
     State          = type;
     MissionEndTime = (endtime != null) ? endtime.Value : other.MissionEndTime;
     sys            = other.sys;
     body           = other.body;
 }
コード例 #14
0
 public void SetRepelStateOn()
 {
     myState = StateTypes.eRepel;
     if(tag == "SmallEnemy")
     {
         SmallEnemy help = (SmallEnemy)this;
         help.myController.NotifyStateChange(myState, null);
     }
 }
コード例 #15
0
 public StateManager(StateTypes startState)
 {
     currentState = startState;
     DaggerfallUI.UIManager.OnWindowChange += UIManager_OnWindowChangeHandler;
     StartGameBehaviour.OnStartMenu        += StartGameBehaviour_OnStartMenuHandler;
     StartGameBehaviour.OnStartGame        += StartGameBehaviour_OnStartGameHandler;
     SaveLoadManager.OnLoad    += SaveLoadManager_OnLoadHandler;
     PlayerDeath.OnPlayerDeath += PlayerDeath_OnPlayerDeathHandler;
 }
コード例 #16
0
    /// <summary>
    /// A call to transition to the nextState passed in.
    /// </summary>
    /// <param name="nextState"> the desired state to transition to. </param>
    public void TransitionToState(StateTypes nextState)
    {
        IBaseState battleState = GetNextState(nextState);

        currentState.OnExit();

        currentState = battleState;

        currentState.OnEnter();
    }
コード例 #17
0
ファイル: StateCreator.cs プロジェクト: AltarnRain/TwiddleToe
        /// <summary>
        /// News the property.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="type">The types.</param>
        /// <param name="access">The access.</param>
        /// <returns>
        /// A new property
        /// </returns>
        private static CodeMemberProperty NewProperty(string name, StateTypes type, MemberAttributes access = MemberAttributes.Public)
        {
            var newProperty = new CodeMemberProperty
            {
                Name       = name,
                Attributes = access | MemberAttributes.Final,
                Type       = GetTypeReference(type)
            };

            return(newProperty);
        }
コード例 #18
0
ファイル: StateCreator.cs プロジェクト: AltarnRain/TwiddleToe
        /// <summary>
        /// News the field.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="type">The type.</param>
        /// <param name="access">The access.</param>
        /// <returns>
        /// A private field
        /// </returns>
        private static CodeMemberField NewField(string name, StateTypes type, MemberAttributes access = MemberAttributes.Private)
        {
            var fieldName = string.Concat(name.Select((c, i) => i == 0 ? char.ToLower(c) : c));
            var fieldType = GetTypeReference(type);
            var field     = new CodeMemberField(fieldType, fieldName)
            {
                Attributes = access
            };

            return(field);
        }
コード例 #19
0
 void OnChangeGameState(StateTypes type)
 {
     if (type == StateTypes.Playing)
     {
         canMove = true;
     }
     else
     {
         canMove = false;
     }
 }
コード例 #20
0
        public MissionState(MissionState other, StateTypes type, DateTime?endtime)            // changed to another state..
        {
            Mission    = other.Mission;
            Redirected = other.Redirected;                                      // no completed, since we can't be - abandoned, failed, died, resurrected
            CargoDepot = other.CargoDepot;

            State          = type;
            MissionEndTime = (endtime != null) ? endtime.Value : other.MissionEndTime;
            sys            = other.sys;
            body           = other.body;
        }
コード例 #21
0
        /// <summary>
        /// 是否包含某个状态_通过状态类型判断,需要包含targetStateTypes的超集才会返回true
        /// </summary>
        /// <param name="targetStateTypes"></param>
        /// <returns></returns>
        public bool ContainsState(StateTypes targetStateTypes)
        {
            foreach (var state in this.m_States)
            {
                if ((targetStateTypes & state.Key) == targetStateTypes && state.Value.Count > 0)
                {
                    return(true);
                }
            }

            return(false);
        }
コード例 #22
0
        /// <summary>
        /// 是否完全包含某个状态,需要包含targetStateTypes一致的时候才会返回true
        /// </summary>
        /// <param name="targetStateTypes"></param>
        /// <returns></returns>
        public bool HasAbsoluteEqualsState(StateTypes targetStateTypes)
        {
            foreach (var state in this.m_States)
            {
                if (targetStateTypes == state.Key && state.Value.Count > 0)
                {
                    return(true);
                }
            }

            return(false);
        }
コード例 #23
0
        /// <summary>
        /// 是否会发生状态互斥,只要包含了conflictStateTypes的子集,就返回true
        /// </summary>
        /// <param name="conflictStateTypes">互斥的状态</param>
        /// <returns></returns>
        public bool CheckConflictState(StateTypes conflictStateTypes)
        {
            foreach (var state in this.m_States)
            {
                if ((conflictStateTypes & state.Key) == state.Key && state.Value.Count > 0)
                {
                    return(true);
                }
            }

            return(false);
        }
コード例 #24
0
        /// <summary>
        /// 是否存在某个状态_通过状态类型获取
        /// </summary>
        /// <param name="stateTypes"></param>
        /// <returns></returns>
        public bool HasState(StateTypes stateTypes)
        {
            foreach (var fsmStateBase in this.m_FsmStateBases)
            {
                if (fsmStateBase.StateTypes == stateTypes)
                {
                    return(true);
                }
            }

            return(false);
        }
コード例 #25
0
        public static NDbResult <List <TSBExchangeGroup> > GetTSBExchangeGroups(TSB tsb,
                                                                                StateTypes state, FinishedFlags flag, DateTime reqBegin, DateTime reqEnd)
        {
            var result          = new NDbResult <List <TSBExchangeGroup> >();
            SQLiteConnection db = Default;

            if (null == db)
            {
                result.DbConenctFailed();
                return(result);
            }
            if (null == tsb)
            {
                result.ParameterIsNull();
                return(result);
            }

            lock (sync)
            {
                MethodBase med = MethodBase.GetCurrentMethod();
                try
                {
                    string cmd = string.Empty;
                    cmd += "SELECT * ";
                    cmd += "  FROM TSBExchangeGroupView ";
                    cmd += " WHERE TSBId = ? ";
                    cmd += "   AND FinishFlag = ? ";
                    if (state != StateTypes.None)
                    {
                        cmd += "   AND State = ? ";
                    }
                    if (reqBegin != DateTime.MinValue)
                    {
                        cmd += "   AND RequestDate >= ? ";
                        if (reqEnd != DateTime.MinValue)
                        {
                            cmd += "   AND RequestDate <= ? ";
                        }
                    }

                    var rets    = NQuery.Query <FKs>(cmd, tsb.TSBId, flag, state, reqBegin, reqEnd).ToList();
                    var results = rets.ToModels();
                    result.Success(results);
                }
                catch (Exception ex)
                {
                    med.Err(ex);
                    result.Error(ex);
                }
                return(result);
            }
        }
コード例 #26
0
    /// <summary>
    /// Validates the transition from the current state to the nextBattleState passed in.
    /// </summary>
    /// <param name="nextBattleState"> The desired next battle state. </param>
    /// <returns> Returns the next state or null depending on the validity of the state transition requested. </returns>
    private IBaseState ValidateStateTransition(StateTypes nextBattleState)
    {
        IBaseState nextState = null;

        StateTransition transition = new StateTransition(currentState.StateType, nextBattleState);

        if (!transitions.TryGetValue(transition, out nextState))
        {
            UnityEngine.Debug.LogError("Invalid Transition");
        }

        return(nextState);
    }
コード例 #27
0
ファイル: StateService.cs プロジェクト: liptonbeer/Template10
        public static async Task <IStateItems> GetStateAsync(StateTypes type, string key = null)
        {
            key = key ?? string.Empty;
            switch (type)
            {
            case StateTypes.Session: return(await StateItems.LoadAsync(key, type));

            case StateTypes.Frame: return(await StateItems.LoadAsync(key, type));

            case StateTypes.Page: return(await StateItems.LoadAsync(key, type));

            default: throw new NotSupportedException(type.ToString());
            }
        }
コード例 #28
0
        public ReturnTypes UpdateState(StateTypes newState)
        {
            log.Info("call");
            if (!IsConnected)
            {
                log.Fatal("Not connected to IZService");
                return(ReturnTypes.rtErrorUnknown);
            }

            var res = collectorService.UpdateState(T(newState));

            log.InfoFormat("result {0}", res);
            return(T(res));
        }
コード例 #29
0
        /// <summary>
        /// 切换状态,如果当前已存在,说明需要把它提到同优先级状态的前面去,让他先执行,切换成功返回成功,切换失败返回失败
        /// 这里的切换成功是指目标状态来到链表头部,插入到链表中或者插入失败都属于切换失败
        /// </summary>
        /// <param name="stateTypes">状态类型</param>
        /// <param name="stateName">状态名称</param>
        /// <param name="priority">状态优先级</param>
        public bool ChangeState <T>(StateTypes stateTypes, string stateName, int priority) where T : AFsmStateBase, new()
        {
            AFsmStateBase aFsmStateBase = this.GetState(stateName);

            if (aFsmStateBase != null)
            {
                this.InsertState(aFsmStateBase, true);
                return(CheckIsFirstState(aFsmStateBase));
            }

            aFsmStateBase = ReferencePool.Acquire <T>();
            aFsmStateBase.SetData(stateTypes, stateName, priority);
            this.InsertState(aFsmStateBase);
            return(CheckIsFirstState(aFsmStateBase));
        }
コード例 #30
0
        public static bool Prefix(ItemActionEntryRepair __instance, StateTypes ___state, string ___lblReadBook, string ___lblNeedMaterials)
        {
            // Check if this feature is enabled.
            if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature))
            {
                return(true);
            }

            StateTypes stateTypes = ___state;

            if (stateTypes == StateTypes.RecipeLocked)
            {
                GameManager.ShowTooltip(__instance.ItemController.xui.playerUI.entityPlayer, ___lblReadBook);
                return(false);
            }
            if (stateTypes != StateTypes.NotEnoughMaterials)
            {
                return(false);
            }

            GameManager.ShowTooltip(__instance.ItemController.xui.playerUI.entityPlayer, ___lblNeedMaterials);
            List <ItemStack> stack = new List <ItemStack>();
            ItemClass        forId = ItemClass.GetForId(((XUiC_ItemStack)__instance.ItemController).ItemStack.itemValue.type);

            if (forId.Properties.Classes.ContainsKey("RepairItems"))
            {
                DynamicProperties dynamicProperties3 = forId.Properties.Classes["RepairItems"];
                stack = ItemsUtilities.ParseProperties(dynamicProperties3);
                ItemsUtilities.CheckIngredients(stack, __instance.ItemController.xui.playerUI.entityPlayer);
                return(false);
            }
            else if (forId.Properties.Contains("RepairItems")) // to support <property name="RepairItems" value="resourceWood,10,resourceForgedIron,10" />
            {
                string strData = forId.Properties.Values["RepairItems"].ToString();
                stack = ItemsUtilities.ParseProperties(strData);
                ItemsUtilities.CheckIngredients(stack, __instance.ItemController.xui.playerUI.entityPlayer);
                return(false);
            }
            else if (forId.RepairTools == null || forId.RepairTools.Length <= 0)
            {
                Recipe recipe = ItemsUtilities.GetReducedRecipes(forId.GetItemName(), 2);
                ItemsUtilities.CheckIngredients(recipe.ingredients, __instance.ItemController.xui.playerUI.entityPlayer);
                return(false);
            }

            return(true);
        }
コード例 #31
0
ファイル: StateCreator.cs プロジェクト: AltarnRain/TwiddleToe
        /// <summary>
        /// Gets the type reference.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns>A CodeTypeReference</returns>
        private static CodeTypeReference GetTypeReference(StateTypes type)
        {
            CodeTypeReference returnValue = null;

            switch (type)
            {
            case StateTypes.Number:
                returnValue = new CodeTypeReference(typeof(int));
                break;

            case StateTypes.Text:
                returnValue = new CodeTypeReference(typeof(string));
                break;
            }

            return(returnValue);
        }
コード例 #32
0
        public StateManager(StateTypes startState = StateTypes.None)
        {
            if(startState == StateTypes.None)
            {
                if (SceneControl.StartupSceneLoaded())
                    startState = StateTypes.Setup;
                else
                    startState = StateTypes.Start;
            }

            ChangeState(startState);
            DaggerfallUI.UIManager.OnWindowChange   += UIManager_OnWindowChangeHandler;
            StartGameBehaviour.OnStartMenu          += StartGameBehaviour_OnStartMenuHandler;
            StartGameBehaviour.OnStartGame          += StartGameBehaviour_OnStartGameHandler;
            SaveLoadManager.OnLoad                  += SaveLoadManager_OnLoadHandler;
            PlayerDeath.OnPlayerDeath               += PlayerDeath_OnPlayerDeathHandler;
        }
コード例 #33
0
        /// <summary>
        /// Changes state to specified state
        /// </summary>
        /// <param name="nextState">desired state</param>
        /// <returns></returns>
        public bool ChangeState(StateTypes nextState)
        {
            if (nextState == CurrentState)
                return false;
            else
            {
                Debug.Log(string.Format("StateManager changing state...previous state: {0} new state: {1}", CurrentState, nextState));
                lastState = CurrentState;
                currentState = nextState;
                TriggerStateChange(nextState);

                if (CurrentState == StateTypes.Start)
                    gameInProgress = false;
                else if (CurrentState == StateTypes.Game)
                    gameInProgress = true;
                return true;
            }
        }
コード例 #34
0
 private void TriggerStateChange(StateTypes state)
 {
     if (OnStateChange != null)
         OnStateChange(state);
 }
コード例 #35
0
ファイル: DBManager.cs プロジェクト: AntonLapshin/hcprojects
        private bool LoadState(StateRows stateRows, StateTypes stateType)
        {
            var source = DataTableGet(Table.TableSecSource.Name);
            if (source == null) return false;
            if (stateRows == null) return false;
            var rows = new List<DataRow>();

            foreach (var row in stateRows.Rows)
            {
                try
                {
                    DataRow dataRow = source.Rows.Find(new object[] { row.Item, row.Loc });
                    var fieldsValues = stateType == StateTypes.Undo ? row.FieldsValuesPrevious : row.FieldsValuesNext;
                    foreach (var field in fieldsValues)
                    {
                        dataRow[field.Field] = field.Value;
                    }
                    rows.Add(dataRow);

                    if (rows.Count > 0)
                        ((OracleDataAdapter)_adapters[Table.TableSecSource.Name]).Update(rows.ToArray());

                }
                catch (Exception ex)
                {
                    Error = ex.Message;
                    return false;
                }
            }
            return true;
        }