// Use this for initialization // <summary> // This method allows the starting of the FSM based on this FA // </summary> // <remarks>It must be called when the FA is complete</remarks> public override void Start() { //Start Method as Deterministic StatesCredits = new Dictionary <int, int>(); foreach (State st in StatesList) { if (st.isInitial()) { existInitial = true; initiallyEnabled.Add(st); //this.initial = st; positionInGraph = StatesList.IndexOf(st); } //add to a dictionary of credits StatesCredits.Add(st.getTag(), (int)st.getCredits()); //st.setEnabledBy(EnableByEvents(st)); if (st.getSubFA() != null) { st.getSubFA().Start(); } } }
public override bool IsValid(object value) { Debug.WriteLine("IsValid?"); Client client = value as Client; if (client.country == null) { // nothing sent this.ErrorMessage = "Client is null"; return(false); } else { bool stateSet = !String.IsNullOrEmpty(client.state); switch (client.country) { case "US": // US validation - state must be set and abbr. should be in the dictionary keys Dictionary <string, string> states = new StatesList().dict(); // empty state? DENIED if (client.state == null) { ErrorMessage = "US && no state! Bad news..."; return(false); } // state abbr. not found in dictionary key? DENIED else if (!states.ContainsKey(client.state)) { Debug.WriteLine(String.Format("US?: {0} && stateSet: {1}", client.country, client.state)); return(false); } else { return(true); } default: // INTERNATIONAL // Non-US and has a state? DENIED if (client.state != null) { Debug.WriteLine(String.Format("US?: {0} && stateSet: {1}", client.country, client.state)); ErrorMessage = "Non-US countries should not have states"; return(false); } else { Debug.WriteLine("International countries do not have a states option set yet, so all good"); return(true); } } } }
public Player(Vector2 position) : base() { attachedObject = GameObject.Instantiate((GameObject)Resources.Load("Prefabs/PlayerObject"), new Vector2(position.x, position.y), Quaternion.identity); objectScript = attachedObject.GetComponent <PlayerObject>(); objectScript.linkedScript = this; attachedObject.GetComponent <Identifier>().linkedScript = this; StatesList.Add("active", typeof(ActiveState)); StatesList.Add("launched", typeof(LaunchedState)); StatesList.Add("stunned", typeof(StunnedState)); state = (State)Activator.CreateInstance(StatesList["active"]); //TODO: DO THIS BETTER LATER 1 (cont on "2") targets.Add(typeof(Grunt)); targets.Add(typeof(Chaser)); mass = 10; //VERY VERY PLACEHOLDER OBJECT FINDING anchor = attachedObject.transform.GetChild(0).gameObject; hook = anchor.transform.GetChild(0).gameObject; hookSource = anchor.transform.GetChild(1).gameObject; hookNodes.Add(anchor.transform.GetChild(2).gameObject); hookNodes.Add(anchor.transform.GetChild(3).gameObject); hookNodes.Add(anchor.transform.GetChild(4).gameObject); hookNodes.Add(anchor.transform.GetChild(5).gameObject); hookNodes.Add(anchor.transform.GetChild(6).gameObject); hookNodes.Add(anchor.transform.GetChild(7).gameObject); hookNodes.Add(anchor.transform.GetChild(8).gameObject); hookNodes.Add(anchor.transform.GetChild(9).gameObject); hookNodes.Add(anchor.transform.GetChild(10).gameObject); hookNodes.Add(anchor.transform.GetChild(11).gameObject); hookNodes.Add(anchor.transform.GetChild(12).gameObject); hookNodes.Add(anchor.transform.GetChild(13).gameObject); hookNodes.Add(anchor.transform.GetChild(14).gameObject); hookNodes.Add(anchor.transform.GetChild(15).gameObject); hookNodes.Add(anchor.transform.GetChild(16).gameObject); hookNodes.Add(anchor.transform.GetChild(17).gameObject); hookStatesList.Add(new HookLoadedState()); foreach (GameObject i in hookNodes) { currentNodePositions.Add(i.transform.position); } hookSize = hook.GetComponent <CircleCollider2D>().radius; Stats["moveSpeed"] = 20; Stats["damage"] = 5; Stats["maxHealth"] = 30; Stats["health"] = Stats["maxHealth"]; }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { string state = (string)value; var statesList = new StatesList(); var states = statesList.dict(); foreach (KeyValuePair <string, string> item in states) { if (item.Key == state) { return(ValidationResult.Success); } } return(new ValidationResult(FormatErrorMessage(validationContext.DisplayName, state))); }
// <summary> // This method allows the starting of the FSM based on this FA // </summary> // <remarks>It must be called when the FA is complete</remarks> public override void Start() { foreach (State st in StatesList) { if (st.isInitial()) { this.existInitial = true; this.initial = st; positionInGraph = StatesList.IndexOf(st); } if (st.getSubFA() != null) { st.getSubFA().Start(); } } }
public void bindlistdata() { foreach (var item in constants.licencesitem) { Id = item.id; DocumentId = item.DocumentId; Licencenumber = item.licenseNumber; Collage = item.college; SateName = item.state; LicenceTitle = item.typeText; Expiredate = Convert.ToDateTime(item.expirationDate); SelectedState = StatesList.FirstOrDefault(q => q.stateAbb == item.state); SelectedLicenseType = LicenceTypees.FirstOrDefault(q => q.title == item.typeText); ShowName = item.originalFileName; // DocumentId = item.documentId; } }
/// <summary> /// 绘制角色状态 /// </summary> private void DrawUnitState() { GUILayout.BeginArea(StateRect, UIStyles.SelectionRect); GUILayout.Label("角色状态", UIStyles.DO_18_White_UpperCenter, GUILayout.Height(20)); GUILayout.Space(4); StatePos = EditorGUILayout.BeginScrollView(StatePos); for (int i = 0; i < Player.States.Count; i++) { EditorGUILayout.BeginHorizontal(); GUILayout.Button(Player.States[i].ToString(), UIStyles.FN1, GUILayout.Width(120)); string[] names = StatesList.ToArray(); int index = GetUnitStatesIndex(i); int select = EditorGUILayout.Popup(string.Empty, index, names, UIStyles.FN0, GUILayout.Width(100), GUILayout.Height(40)); if (select != index) { ChangeUnitStates(i, select); } EditorGUILayout.EndHorizontal(); GUILayout.Space(10); } EditorGUILayout.EndScrollView(); GUILayout.EndArea(); }
public Chaser(Vector2 position) { attachedObject = GameObject.Instantiate((GameObject)Resources.Load("Prefabs/ChaserObject"), position, Quaternion.identity); objectScript = attachedObject.GetComponent <ChaserObject>(); objectScript.linkedScript = this; attachedObject.GetComponent <Identifier>().linkedScript = this; StatesList.Add("active", typeof(ChaserActiveState)); StatesList.Add("launched", typeof(EnemyLaunchedState)); StatesList.Add("stunned", typeof(EnemyStunnedState)); state = (State)Activator.CreateInstance(StatesList["active"]); //BEHAVIOUR VALUES mass = 5; decisionTimerMax = 1.5f; attackRadius = 2.5f; //STATS Stats["maxHealth"] = 8; Stats["moveSpeed"] = 15; Stats["damage"] = 3; Stats["health"] = Stats["maxHealth"]; }
public void Add <T>(T model) { var theType = model.GetType().Name; switch (theType) { case "User": UsersList.Add(model as User); return; case "News": NewsesList.Add(model as Dal.Models.News); return; case "Category": CategoriesList.Add(model as Category); return; case "Magazine": MagazinesList.Add(model as Magazine); return; case "SmartLink": SmartLinksList.Add(model as SmartLink); return; case "Comment": CommentsList.Add(model as Comment); return; case "Visit": VisitsList.Add(model as Visit); return; case "NewsLetter": NewsLettersList.Add(model as NewsLetter); return; case "Slider": SlidersList.Add(model as Slider); return; case "Slide": SlidesList.Add(model as Slide); return; case "UserMagazine": UserMagazinesList.Add(model as UserMagazine); return; case "State": StatesList.Add(model as State); return; case "City": CitiesList.Add(model as City); return; case "Media": MediasList.Add(model as Media); return; case "Report": ReportsList.Add(model as Report); return; case "Vote": VotesList.Add(model as Vote); return; case "Advertise": AdvertisesList.Add(model as Advertise); return; case "AdCategory": AdCategoriesList.Add(model as AdCategory); return; case "Galery": GaleriesList.Add(model as Galery); return; case "GaleryImage": GaleryImagesList.Add(model as GaleryImage); return; case "Image": ImagesList.Add(model as Image); return; case "KeyPoint": KeyPointsList.Add(model as KeyPoint); return; case "KeyPointsContainer": KeyPointsContainersList.Add(model as KeyPointsContainer); return; case "Quiz": QuizesList.Add(model as Quiz); return; case "Question": QuestionsList.Add(model as Question); return; case "Answer": AnswersList.Add(model as Answer); return; case "Option": OptionList.Add(model as Option); return; case "ItemList": ItemsListList.Add(model as ItemList); return; default: throw new Exception("The type " + theType + " is not supported."); } }