public void Setup(Entity e, Context context) { e.AddComp <C_Position>(); e.AddComp <C_Rotation>(); TowerEntry towerEntry = e.GetComp <C_TowerConfig>().cfg; C_Asset asset = e.AddComp <C_Asset>(); asset.mesh = "Mesh/TowerTest"; // towerEntry.asset; asset.material = "Materials/Blue"; e.AddComp <C_Renderer>(); var findTarget = e.AddComp <C_TowerFindTarget>(); findTarget.range = towerEntry.range / 100f; e.AddComp <C_TowerFindTargetGizmos>(); C_TowerAttack attack = e.AddComp <C_TowerAttack>(); attack.timer = 0; attack.preAttack = towerEntry.postAttack; attack.postAttack = towerEntry.postAttack; e.AddComp <C_Target>(); }
public void Setup(Entity e, Context context) { e.AddComp <C_Position>(); e.AddComp <C_Rotation>(); C_Collider collider = e.AddComp <C_Collider>(); collider.threshold = 0.15f; e.AddComp <C_ClickToBuild>(); e.AddComp <C_Renderer>(); C_Asset asset = e.AddComp <C_Asset>(); asset.mesh = "Mesh/TowerSlot"; asset.material = "Materials/Default"; }
public void Setup(Entity e, Context context) { e.AddComp <C_Position>(); e.AddComp <C_Rotation>(); e.AddComp <C_TargetPos>(); e.AddComp <C_Target>(); var hitAlways = e.AddComp <C_BulletHitTargetAlways>(); var moveToPos = e.AddComp <C_MoveToPos>(); moveToPos.speed = 8f; e.AddComp <C_Renderer>(); C_Asset asset = e.AddComp <C_Asset>(); asset.mesh = "Mesh/Bullet"; asset.material = "Materials/Default"; }
public void Setup(Entity e, Context context) { e.AddComp <C_IdentifyMonster>(); C_Position position = e.AddComp <C_Position>(); Entity e1 = context.SelectOne <C_LevelData>(); LinkedListNode <LevelEntry.TileData> first = e1.GetComp <C_LevelData>().paths.First; position.position = first.Value.position; e.AddComp <C_Rotation>(); MonsterEntry monsterEntry = e.GetComp <C_MonsterConfig>().cfg; C_MonsterFindPath monsterFindPath = e.AddComp <C_MonsterFindPath>(); monsterFindPath.target = first; monsterFindPath.rotating = 0; e.AddComp <C_TargetPos>(); e.AddComp <C_MoveToPos>().speed = monsterEntry.speed / 100f; e.AddComp <C_MoveStart>(); C_MonsterHp hp = e.AddComp <C_MonsterHp>(); int h = monsterEntry.hp / 100; hp.max = h; hp.rest = h; C_Asset asset = e.AddComp <C_Asset>(); asset.mesh = "Mesh/MonsterTest"; // monsterEntry.asset; asset.material = "Materials/Red"; e.AddComp <C_Renderer>(); }
public void Update(int filterIndex, Selection selection, float deltaTime) { switch (filterIndex) { case 0: isNewFrame = selection.First().GetComp <C_FrameIndex>().newFrame; break; case 1: if (!isNewFrame) { return; } foreach (var s in selection) { C_Asset asset = s.GetComp <C_Asset>(); if (!string.IsNullOrWhiteSpace(asset.mesh)) { var mesh = ResourceManager.Instance.LoadAsset <Mesh>(asset.mesh); s.AddComp <C_Mesh>().mesh = mesh; asset.mesh = null; } if (!string.IsNullOrWhiteSpace(asset.material)) { var material = ResourceManager.Instance.LoadAsset <Material>(asset.material); s.AddComp <C_Material>().material = material; asset.material = null; } } break; } }