// Update is called once per frame void Update() { if (entity == StateStaticComponent.m_currentEntity) { if (entity.GetComponent <BlockInfoComponent>().m_blockType == BlockType.Player) { if (skill == null) { ShowSkill(StateStaticComponent.m_currentEntity); } if (Input.GetButtonDown("Bag")) { if (bag != null) { CloseBag(); } else { ShowBag(StateStaticComponent.m_currentEntity); } } if (Input.GetButtonDown("ShowPropety")) { if (propety.activeSelf) { propety.SetActive(false); } else { propety.SetActive(true); } } } } else { entity = StateStaticComponent.m_currentEntity; CloseSkill(); CloseBag(); } if (Input.GetButtonDown("ShowTips")) { if (tips.activeSelf) { tips.SetActive(false); } else { tips.SetActive(true); } } }
// Update is called once per frame void Update() { if (StateStaticComponent.m_currentEntity != null) { if (StateStaticComponent.m_currentEntity.GetComponent <BlockInfoComponent>().m_blockType == BlockType.Player) { currentRole = StateStaticComponent.m_currentEntity; } } LoadInfo(); }
public void UpdateDistanceFieldTransformations(List <BasicEntity> entities, List <SignedDistanceField> sdfDefinitions, DeferredEnvironmentMapRenderModule environmentMapRenderModule, GraphicsDevice graphics, SpriteBatch spriteBatch, LightAccumulationModule lightAccumulationModule) { if (!GameSettings.sdf_draw) { return; } //First of all let's build the atlas UpdateAtlas(sdfDefinitions, graphics, spriteBatch, environmentMapRenderModule, lightAccumulationModule); int i = 0; for (var index = 0; index < entities.Count; index++) { BasicEntity entity = entities[index]; if (entity.SignedDistanceField.IsUsed) { _instanceInverseMatrixArray[i] = entity.WorldTransform.InverseWorld; _instanceScaleArray[i] = entity.WorldTransform.Scale; _instanceSDFIndexArray[i] = entity.SignedDistanceField.ArrayIndex; i++; if (i >= InstanceMaxCount) { break; } } } _instancesCount = i; //TODO: Check for change //Submit //Instances _instanceInverseMatrixArrayParam.SetValue(_instanceInverseMatrixArray); _instanceScaleArrayParam.SetValue(_instanceScaleArray); _instanceSDFIndexArrayParam.SetValue(_instanceSDFIndexArray); _instancesCountParam.SetValue((float)_instancesCount); lightAccumulationModule.PointLightRenderModule.deferredPointLightParameter_InstanceInverseMatrix.SetValue(_instanceInverseMatrixArray); lightAccumulationModule.PointLightRenderModule.deferredPointLightParameter_InstanceScale.SetValue(_instanceScaleArray); lightAccumulationModule.PointLightRenderModule.deferredPointLightParameter_InstanceSDFIndex.SetValue(_instanceSDFIndexArray); lightAccumulationModule.PointLightRenderModule.deferredPointLightParameter_InstancesCount.SetValue((float)_instancesCount); environmentMapRenderModule.ParamInstanceInverseMatrix.SetValue(_instanceInverseMatrixArray); environmentMapRenderModule.ParamInstanceScale.SetValue(_instanceScaleArray); environmentMapRenderModule.ParamInstanceSDFIndex.SetValue(_instanceSDFIndexArray); environmentMapRenderModule.ParamInstancesCount.SetValue((float)_instancesCount); }
public PageComponent(BasicEntity parent, Coord position) : base(true, false, true, true) { Parent = parent; Position = position; Component = (T)parent.GetConsoleComponent <T>(); Name = "Display for " + Component.Name; InitWindow(); InitButton(); InitBackground(); InitTextSurface(); }
public static List <string> ContainerTypeValidation(BasicEntity <string> selectedContainer) { if (selectedContainer == null || selectedContainer.Id < 0) { return new List <string> { "Container type field is mandatory." } } ; return(null); //return new List<string> { "Container type is invalid." }; }
public Match() { gameOperator = new GameOperator(); spriteBatch = new SpriteBatch(Global.Instance.Graphics); returnToMenu = new Button(); continueGame = new Button(); setting = new Button(); save = new Button(); pauseScreen = new BasicEntity(); playerOneInstruction = new TextEntity(); playerTwoInstruction = new TextEntity(); }
public static List <string> BloodTypeValidation(BasicEntity <string> bloodType) { if (bloodType is null || bloodType.Id < 0) { return new List <string> { "Blood type field is mandatory." } } ; return(null); }
/// <summary> /// Validates the county of the address. /// </summary> /// <param name="county">The county of the address.</param> /// <returns></returns> public static List <string> CountyValidation(BasicEntity <string> county) { if (county is null || county.Id < 0) { return new List <string> { "County field is mandatory." } } ; return(null); }
public static List <string> ContainerTypeValidation(BasicEntity <string> containerType) { if (containerType is null || containerType.Id < 0) { return new List <string> { "Container type is mandatory." } } ; return(null); }
public static List <string> RHValidation(BasicEntity <string> rh) { if (rh is null || rh.Id < 0) { return new List <string> { "RH field is mandatory." } } ; return(null); }
public void AddHackerAbility(BasicEntity entity) { AbilityComponent ability = entity.GetComponent <AbilityComponent> (); // ability.m_temporaryAbility.Add (ComponentType.Drone); ability.m_temporaryAbility.Add(ComponentType.Move); ability.m_temporaryAbility.Add(ComponentType.Attack); ability.m_temporaryAbility.Add(ComponentType.Knock); ability.m_temporaryAbility.Add(ComponentType.Input); ability.m_temporaryAbility.Add(ComponentType.Item); }
public void AddVeteranAbility(BasicEntity entity) { AbilityComponent ability = entity.GetComponent <AbilityComponent> (); ability.m_temporaryAbility.Add(ComponentType.Move); ability.m_temporaryAbility.Add(ComponentType.Attack); ability.m_temporaryAbility.Add(ComponentType.Knock); ability.m_temporaryAbility.Add(ComponentType.CheerUp); ability.m_temporaryAbility.Add(ComponentType.Input); ability.m_temporaryAbility.Add(ComponentType.Item); }
/// <summary> /// Determines whether the specified object is equal to the current <see cref="BasicEntity{Type}"/>. /// </summary> /// <param name="obj">The object o compare with the current <see cref="BasicEntity{Type}"/>.</param> /// <returns></returns> public override bool Equals(object obj) { // If the object is null or has a different type if (obj is null || obj.GetType() != GetType()) { return(false); } BasicEntity <Type> be = obj as BasicEntity <Type>; return(Value.Equals(be.Value)); }
/// <summary> /// Validates the selected person name. /// </summary> /// <param name="personName">The selected person name.</param> /// <returns></returns> public static List <string> PersonNameValidation(BasicEntity <string> personName) { if (personName is null || personName.Id < 0) { return new List <string> { "Person name field is mandatory." } } ; return(null); }
public static List <string> NotNullStringFieldValidation(BasicEntity <string> field, string message) { if (field is null || field.Id < 0) { return new List <string> { message + " field is mandatory." } } ; return(null); }
public int TendencyToExplain; // e public SpeechComponent(BasicEntity parent) : base(isUpdate: true, isKeyboard: false, isDraw: true, isMouse: false) { Parent = parent; Name = "Speech"; TendencyToMinimize = Calculate.PercentValue(); // m TendencyToInvalidate = Calculate.PercentValue(); // i TendencyToDeny = Calculate.PercentValue(); // d TendencyToJustify = Calculate.PercentValue(); // j TendencyToArgue = Calculate.PercentValue(); // a TendencyToDefend = Calculate.PercentValue(); // d TendencyToExplain = Calculate.PercentValue(); // e }
public Room() { var res = ResManager.Instance; playerInfo = new Character[] { new Character(), new Character(), new Character(), new Character() }; player2Info = new Character[] { new Character(), new Character(), new Character(), new Character() }; background = new BasicEntity(); multiplayerTitle = new TextEntity(); multiplayerEnabled = new TextEntity(); multiplayerDisabled = new TextEntity(); title = new TextEntity(); playerTypeTitle = new TextEntity(); player = new Character(); previousPlayer = new BasicEntity(); nextPlayer = new BasicEntity(); player2TypeTitle = new TextEntity(); player2 = new Character(); previousPlayer2 = new BasicEntity(); nextPlayer2 = new BasicEntity(); fight = new Button(); returnToMenu = new Button(); numOfBotsTitle = new TextEntity(); numOfBotsEntity = new TextEntity(); decreaseNumOfBots = new BasicEntity(); increaseNumOfBots = new BasicEntity(); map = new BasicEntity(); previousMap = new BasicEntity(); nextMap = new BasicEntity(); }
/// <summary> /// Validates the favourite donation center of the donor. /// </summary> /// <param name="donationCenter">The favourite donation center of the donor.</param> /// <returns></returns> public static List <string> FavouriteDonationCenterValidation(BasicEntity <string> donationCenter) { if (donationCenter.Id < 0) { return new List <string> { "Favourite donation center is mandatory." } } ; return(null); } }
public void Setup() { _ui = MockGame.Menu; _main = _ui.MainOptions; _help = _ui.HelpOptions; _settings = _ui.SettingsOptions; _activePanels = _ui.ActivePanels; _selector = _ui.Player; _newGame = _ui.NewGameOptions; _newGameAdvanced = _ui.NewGameAdvancedOptions; //Panels = new MenuPanel[] { main, help, settings, newGame, newGameAdvanced }; }
/// <summary> /// Validates the selected donation center. /// </summary> /// <param name="donationCenter">The selected donation center.</param> /// <returns></returns> public static List <string> DonationCenterValidation(BasicEntity <string> donationCenter) { if (donationCenter is null || donationCenter.Id < 0) { return new List <string> { "Donation center field is mandatory." } } ; return(null); } }
static public bool FriendInSight(BasicEntity entity) { MonitorComponent monitor = entity.GetComponent <MonitorComponent> (); foreach (BasicEntity e in StateStaticComponent.enemyActionList) { if (monitor.m_view.Contains(e.GetComponent <BlockInfoComponent> ().m_logicPosition)) { return(true); } } return(false); }
void HealthPotion(BasicEntity entity) { entity.GetComponent <DeadComponent>().hp += 10; ItemComponent itemComp = entity.GetComponent <ItemComponent>(); //移除瓶子 itemComp.item.Remove(ItemType.HealthPotion); entity.GetComponent <ItemComponent>().current = ItemType.Null; entity.GetComponent <StateComponent>().AnimationStart(); StateStaticComponent.m_currentSystemState = StateStaticComponent.SystemState.Action; entity.GetComponent <StateComponent>().Invoke("AnimationEnd", 1); }
public void Generate(BasicEntity entity) { //Extract all triangles //foreach (ModelMesh modelmesh in entity.Model.Meshes) //{ // foreach (ModelMeshPart part in modelmesh.MeshParts) // { // VertexPositionNormalTexture[] vertices = new VertexPositionNormalTexture[part.VertexBuffer.VertexCount]; // part.VertexBuffer.GetData<VertexPositionNormalTexture>(vertices); // ushort[] drawOrder = new ushort[part.IndexBuffer.IndexCount]; // part.IndexBuffer.GetData<ushort>(drawOrder); // foreach (var vertex in vertices) // { // points.Add(vertex.Position); // } // } //} generateTris = Task.Factory.StartNew(() => { int[] indices; ModelDataExtractor.GetVerticesAndIndicesFromModel(entity.Model, out vertices, out indices); triangles = new Triangle[indices.Length / 3]; for (var index = 0; index < vertices.Length; index++) { vertices[index] = Vector3.Transform(vertices[index], entity.WorldTransform.World); } int baseIndex = 0; for (var i = 0; i < triangles.Length; i++, baseIndex += 3) { triangles[i].a = vertices[indices[baseIndex]]; triangles[i].b = vertices[indices[baseIndex + 1]]; triangles[i].c = vertices[indices[baseIndex + 2]]; //normal triangles[i].n = Vector3.Cross(triangles[i].c - triangles[i].a, triangles[i].b - triangles[i].a); triangles[i].ba = triangles[i].b - triangles[i].a; triangles[i].cb = triangles[i].c - triangles[i].b; triangles[i].ac = triangles[i].a - triangles[i].c; } }); //for (var index = 0; index < points.Length; index++) //{ // points[index] = Vector3.Transform(points[index], entity.WorldTransform.World); //} }
public async Task <IActionResult> PostBasicEntity([FromBody] BasicEntity basicEntity) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } int maxRowVersion = GetNewMaxRowVersion(); basicEntity.RowVersion = maxRowVersion; _context.BasicEntity.Add(basicEntity); await _context.SaveChangesAsync(); return(CreatedAtAction("GetBasicEntity", new { id = basicEntity.Id }, basicEntity)); }
// Use this for initialization void Start() { entity = null; skill = null; bag = null; UiManager.uiManager = this; ShowCondition(); ShowPropety(); ShowTips(); ShowTurn(); tips.SetActive(false); propety.SetActive(false); }
public void Update(List <BasicEntity> entities, GraphicsDevice graphics, DistanceFieldRenderModule distanceFieldRenderModule, FullScreenTriangle fullScreenTriangle, ref List <SignedDistanceField> sdfDefinitionsOut) { //First let's check which entities need building, if at all! sdfDefinitions.Clear(); //This should preferably be a list of meshes that are in the scene, instead of a list of entities for (var index0 = 0; index0 < entities.Count; index0++) { BasicEntity entity = entities[index0]; if (!entity.SignedDistanceField.IsUsed) { continue; } if (entity.SignedDistanceField.NeedsToBeGenerated) { GenerateDistanceFields(entity, graphics, distanceFieldRenderModule, fullScreenTriangle); } bool found = false; //Compile a list of all mbbs used right now for (var i = 0; i < sdfDefinitions.Count; i++) { if (entity.SignedDistanceField == sdfDefinitions[i]) { found = true; break; } } if (!found) { sdfDefinitions.Add(entity.SignedDistanceField); } } //Now for the model definitions for (var i = 0; i < sdfDefinitions.Count; i++) { if (GameSettings.sdf_regenerate) { sdfDefinitions[i].NeedsToBeGenerated = true; } } GameSettings.sdf_regenerate = false; sdfDefinitionsOut = sdfDefinitions; }
/// <summary> /// Create a static physics mesh from a model and scale. /// </summary> /// <param name="entity"></param> private void AddStaticPhysics(BasicEntity entity) { BEPUutilities.Vector3[] vertices; int[] indices; ModelDataExtractor.GetVerticesAndIndicesFromModel(entity.Model, out vertices, out indices); var mesh = new StaticMesh(vertices, indices, new AffineTransform( new BEPUutilities.Vector3(entity.Scale.X, entity.Scale.Y, entity.Scale.Z), Quaternion.CreateFromRotationMatrix(MathConverter.Convert(entity.RotationMatrix)), MathConverter.Convert(entity.Position))); entity.StaticPhysicsObject = mesh; _physicsSpace.Add(mesh); }
public Heretic(BasicEntity entity) : base(entity) { m_enemeyTyep = PropertyComponent.CharacterType.Heretic; m_decisions = new Dictionary <AIComponent.Decision, BasicDecision <Heretic> > (); //根据枚举获取对应实例 foreach (AIComponent.Decision decision in containDecision) { m_decisions.Add(decision, CreateDecision(decision)); } //默认状态是巡逻状态 m_currentDecision = m_decisions [AIComponent.Decision.Patrol]; m_previsousDecsion = m_currentDecision; }
//增加临时组件 public bool AddTemporaryComponent(BasicEntity entity) { AbilityComponent ability = entity.GetComponent <AbilityComponent> (); if (ability == null) { return(false); } foreach (ComponentType c in ability.m_temporaryAbility) { entity.AddComponent(c); } return(true); }
public void ShowSkill(BasicEntity entity) { if (skill != null) { return; } skill = (GameObject)Resources.Load("Prefabs/UI/Panel/UISkill"); skill = Instantiate(skill); skill.transform.SetParent(gameObject.transform); skill.transform.localPosition = skill.transform.position; skill.transform.localScale = Vector3.one; UiSkill uiSkill = skill.transform.GetChild(1).gameObject.AddComponent <UiSkill>(); uiSkill.AddClick(entity); }
public async Task RedisSetMock_CanSetAndFetch() { // Arrange var expected = new BasicEntity { Id = "RedisSetMock_CanSetAndFetch" }; // Act await _context.Entity.InsertAsync(expected); var returned = await _context.Entity.FetchAsync(expected.Id); // Assert Assert.Equal(expected.Id, returned.Id); // Cleanup await _context.Entity.DeleteAsync(expected); }
public async Task RedisSetMock_CanDelete() { // Arrange var expected = new BasicEntity { Id = "RedisSetMock_CanDelete" }; // Act await _context.Entity.InsertAsync(expected); var returned = await _context.Entity.FetchAsync(expected.Id); await _context.Entity.DeleteAsync(expected); var returnedAfterDelete = await _context.Entity.FetchAsync(expected.Id); // Assert Assert.Equal(expected.Id, returned.Id); Assert.Null(returnedAfterDelete); }
public void EntityProperties_SerializedClass_CanConvertToEntityProperties() { // Arrange var expectedId = "SomeId"; var ob = new BasicEntity { Id = expectedId }; var data = _serializer.PackSingleObject(ob); // Act var entityProperties = new EntityProperties(data); var containsId = entityProperties.ContainsKey("Id"); string returnedId; var isString = entityProperties["Id"].TryGet(out returnedId); // Assert Assert.True(containsId); Assert.True(isString); Assert.Equal(expectedId, returnedId); }
public async Task RedisSetMock_Update_CannotUpdateChangedItem() { // Arrange var entity = new BasicEntity { Id = "RedisSetMock_Update_CannotUpdateChangedItem", StringValue = "Original" }; // Act await _context.Entity.InsertOrReplaceAsync(entity); var retrieved = await _context.Entity.FetchAsync(entity.Id); retrieved.StringValue = "Replacement"; var canUpdate = await _context.Entity.UpdateAsync(retrieved); entity.StringValue = "New Replacement"; var canUpdateChangedItem = await _context.Entity.UpdateAsync(entity); var returned = await _context.Entity.FetchAsync(entity.Id); // Assert Assert.True(canUpdate); Assert.False(canUpdateChangedItem); Assert.Equal(retrieved.Id, returned.Id); Assert.Equal(retrieved.StringValue, returned.StringValue); // Cleanup await _context.Entity.DeleteAsync(entity); }
public async Task RedisSetMock_InsertOrReplace_CanOverwrite() { // Arrange var id = "RedisSetMock_InsertOrReplace_CanOverwrite"; var entityOld = new BasicEntity { Id = id, StringValue = "Original" }; var entityNew = new BasicEntity { Id = id, StringValue = "Replacement" }; // Act await _context.Entity.InsertOrReplaceAsync(entityOld); await _context.Entity.InsertOrReplaceAsync(entityNew); var returned = await _context.Entity.FetchAsync(id); // Assert Assert.Equal(entityNew.Id, returned.Id); Assert.Equal(entityNew.StringValue, returned.StringValue); // Cleanup await _context.Entity.DeleteAsync(entityNew); }
public async Task RedisSetMock_Update_CannotInsertMissingItem() { // Arrange var entity = new BasicEntity { Id = "RedisSetMock_Update_CannotInsertMissingItem" }; // Act var success = await _context.Entity.UpdateAsync(entity); var returned = await _context.Entity.FetchAsync(entity.Id); // Assert Assert.False(success, "Update created missing item"); Assert.Null(returned); // Cleanup await _context.Entity.DeleteAsync(entity); }
public void Setup() { _matcher = new BasicMatcher(); _be = new BasicEntity { Id = Guid.NewGuid(), Name = "Dillon", Number = 69 }; _bm = new BasicModel { id = Guid.NewGuid(), name = "Dillon", number = 69 }; }
public async Task RedisSetMock_Insert_CannotOverwrite() { // Arrange var entity = new BasicEntity { Id = "RedisSetMock_Insert_CannotOverwrite" }; // Act var canInsert = await _context.Entity.InsertAsync(entity); var canOverwrite = await _context.Entity.InsertAsync(entity); // Assert Assert.True(canInsert, "Insert not successful"); Assert.False(canOverwrite, "Can Overwrite"); // Cleanup await _context.Entity.DeleteAsync(entity); }
public async Task RedisSetMock_Replace_CannotInsertItem() { // Arrange var entity = new BasicEntity { Id = "RedisSet_Replace_CannotInsertItem", StringValue = "Original" }; // Act var success = await _context.Entity.ReplaceAsync(entity); var returned = await _context.Entity.FetchAsync(entity.Id); // Assert Assert.False(success); Assert.Null(returned); }
public void RedisSetMock_Migrate_MigrationFunctionsGetsCalled() { // Arrange var entity = new BasicEntity { Id = "RedisSet_Migrate_MigrationFunctionsGetsCalled", StringValue = "SomeValue" }; // Act var result = RedisSetMock<BasicEntityVersioned>.MigrateFrom(entity); // Assert Assert.Equal(entity.Id, result.Id); Assert.Equal(entity.StringValue, result.StringValueRename); Assert.Equal("Prefix_" + entity.StringValue, result.StringValuePrefixed); Assert.Equal(entity.StringValue + "_Suffix", result.StringValueSuffixed); }
public async Task RedisSetMock_Replace_CanUpdateExistingItem() { // Arrange var oldEntity = new BasicEntity { Id = "RedisSet_Replace_CanUpdateExistingItem", StringValue = "Original" }; var newEntity = new BasicEntity { Id = "RedisSet_Replace_CanUpdateExistingItem", StringValue = "Repalcement" }; // Act await _context.Entity.InsertOrReplaceAsync(oldEntity); var success = await _context.Entity.ReplaceAsync(newEntity); var returned = await _context.Entity.FetchAsync(oldEntity.Id); // Assert Assert.True(success); Assert.Equal(newEntity.Id, returned.Id); Assert.Equal(newEntity.StringValue, returned.StringValue); // Cleanup await _context.Entity.DeleteAsync(oldEntity); }