private void CreatePersonsObject(Type type, Int16 X, Int16 Z, CellState role) { ConstructorInfo ctor = type.GetConstructors().First(); this.gameField.SetPersonVertices(X, Z, role, out this.currentPersonVertices); HumansBase obj = ctor.Invoke(new Object[] { this.Game }) as HumansBase; MethodInfo methodSetVertices = type.GetMethod("SetVertices"); methodSetVertices.Invoke(obj, new Object[] { this.currentPersonVertices }); MethodInfo methodLoadTexture = type.GetMethod("LoadTextures"); methodLoadTexture.Invoke(obj, null); MethodInfo methodSetTargetPos = type.GetMethod("SetTargetPosition"); methodSetTargetPos.Invoke(obj, new Object[] { new Point(X, Z) }); this.listOfPersons.Add(obj); }
private void gameField_OnPersonClicked(Object o, CellState role) { if (this.PersonSelected) { var result = from target in this.listOfPersons where target.Role == role select target; this.selectedPerson = result.ElementAt(0); this.SelectedRole = role; if (this.menusCaller == null) { this.menusCaller = this.Game.Components.OfType <MenusCaller>().ElementAt(0); this.menusCaller.OnCallerButtonPressed += new MenusCaller.CallerButtonPressed(menusCaller_OnCallerButtonPressed); this.menusCaller.OnPersonButtonPressed += new MenusCaller.PersonButtonPressed(menusCaller_OnPersonButtonPressed); } this.menusCaller.SetShowPersonOnBar(this.selectedPerson.FaceTex, selectedPerson.Role); } else { this.menusCaller.SetShowPersonOnBar(null, CellState.Forbidden); this.selectedPerson = null; } }
private void menusCaller_OnCallerButtonPressed(Object o) { this.menusCaller.SetShowPersonOnBar(null, CellState.Forbidden); this.selectedPerson = null; this.PersonSelected = false; }