public void Init(Hashtable changeStateData) { _gameMode = GameMode.COMBAT; _playerCombatSystem = _diContainer.Resolve<PlayerCombatSystem>(); _buildSystem = _diContainer.Resolve<BuildingSystem>(); _inventorySystem = _diContainer.Resolve<InventorySystem>(); _enemySystem = _diContainer.Resolve<EnemySystem>(); _lootSystem = _diContainer.Resolve<LootSystem>(); _particleGod = _diContainer.Resolve<ParticleGOD>(); _monsterGenerator = _diContainer.Resolve<MonsterGenerator>(); Singleton.instance.audioSystem.GenerateAudioLookupForLevel(); _particleGod.InitParticlePool(); //HUD _hudController = new HUDController(_gameConfig.playerConfig,_gameConfig.hudConfig); _hudController.Start(() => { _monsterGenerator.Init(_hudController, _playerCombatSystem); }); _playerCombatSystem.Init(_hudController); _buildSystem.Init(); _enemySystem.Init(); _lootSystem.Init(); _inventorySystem.Init(); // Get CombatPlayerView //_playerCombatSystem.isEnabled = true; _dispatcher.AddListener(GameplayEventType.DAMAGE_TAKEN, onDamageTaken); _dispatcher.AddListener(GameplayEventType.GAME_COMPLETE, onGameComplete); _dispatcher.AddListener(GameplayEventType.GAME_RETRY, onGameRetry); }
public override bool OnUse(GameObject playerObj) { BuildingSystem buildingSystem = playerObj.GetComponent <BuildingSystem>(); buildingSystem.build(gameObject); return(true); }
// Use this for initialization void Start() { firstPersonCamera = Camera.main.GetComponent <Camera>(); characterController = GetComponent <CharacterController>(); mouseController = GetComponent <MouseController>(); buildingSystem = GetComponent <BuildingSystem>(); animator = GetComponent <Animator>(); if (GameObject.FindGameObjectWithTag("Player") != null) { PlayerInventory playerInv = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerInventory>(); if (playerInv.inventory != null) { inventory = playerInv.inventory; } if (playerInv.craftSystem != null) { craftSystem = playerInv.craftSystem; } if (playerInv.characterSystem != null) { characterSystem = playerInv.characterSystem; } } buildingSystem.buildMenuPanel.SetActive(false); }
private void CheckStronghold() { if (aiStronghold.CheckFinish() && workerList.Count < 3 && !aiStronghold.GetComponent <UnitTraining>().IsTraining() && playerStat.GetEther() >= 100) { aiStronghold.GetComponent <UnitTraining>().TrainOrder(0); } if (aiStronghold.CheckFinish() && !aiBarrack && playerStat.GetEther() >= 850) { BuildingSystem barrackDummy = aiStronghold.GetComponent <ConstructSystem>().GetBuildingToConstruct(0); GameObject posDummy = Instantiate(aiPointDummy, aiStronghold.transform.position, aiStronghold.transform.rotation) as GameObject; posDummy.transform.Rotate(new Vector3(0, Random.Range(110f, 150f), 0)); posDummy.transform.position += posDummy.transform.forward * Random.Range(25f, 30f); aiBarrack = Instantiate(barrackDummy, posDummy.transform.position, aiStronghold.transform.rotation) as BuildingSystem; aiBarrack.transform.Rotate(new Vector3(0, 180, 0)); aiBarrack.StartToBuild(playerStat.GetPlayerNumber()); playerStat.SetEther(playerStat.GetEther() - 850); } if (aiStronghold.CheckFinish() && !aiStable && playerStat.GetEther() >= 1000) { BuildingSystem stableDummy = aiStronghold.GetComponent <ConstructSystem>().GetBuildingToConstruct(2); GameObject posDummy = Instantiate(aiPointDummy, aiStronghold.transform.position, aiStronghold.transform.rotation) as GameObject; posDummy.transform.Rotate(new Vector3(0, Random.Range(200f, 240f), 0)); posDummy.transform.position += posDummy.transform.forward * Random.Range(25f, 30f); aiStable = Instantiate(stableDummy, posDummy.transform.position, aiStronghold.transform.rotation) as BuildingSystem; aiStable.transform.Rotate(new Vector3(0, 180, 0)); aiStable.StartToBuild(playerStat.GetPlayerNumber()); playerStat.SetEther(playerStat.GetEther() - 800); } }
// Update is called once per frame void Update() { coolNow -= Time.deltaTime; if (stat.GetAlive()) { if (isBuilding) { BuildingSystem bui = GetComponent <BuildingSystem>(); if (bui.CheckFinish()) { CheckTarget(); } else { target = null; } } else { CheckTarget(); } } else { target = null; } }
public void AddNewPhase() { int ix = Phases.Count + 1; var phase = new Phase { Index = ix, JobId = Phases.First().JobId, }; if (phase != null) { BuildingSystem bs = new BuildingSystem { FullName = "TBD", ActualBoardFeet = 0, Code = "TBD", EstimatedBoardFeet = 0 }; phase.BuildingSystems = new List <BuildingSystem>() { bs }; } var lister = new List <Phase>(); Phases.ForEach(p => lister.Add(p)); lister.Add(phase); Phases.Clear(); Phases = new ObservableCollection <Phase>(lister); OnPropertyChanged(nameof(Phases)); }
void Awake() { EventManager.instance.onModeChanged += ResetLastClickedTile; instance = this; gridWidth = MapSizeController.mapSize; gridHeight = MapSizeController.mapSize; grid = new GridXZ(gridWidth, gridHeight, cellSize, Vector3.zero); // Create ground visual float groundSizeX = gridWidth * cellSize; float groundSizeY = gridHeight * cellSize; ground = Instantiate(groundVisualPrefab, new Vector3(groundSizeX / 2, -0.5f, groundSizeY / 2), Quaternion.identity); ground.localScale = new Vector3(groundSizeX, 1, groundSizeY); selectedBuildingSO = null; currentBuildingRotation = BuildingTypeSO.Direction.Down; float spawnChance = 0.05f; // The spawning chance of the trees when the game starts for (int i = 0; i < gridWidth; i++) { for (int j = 0; j < gridHeight; j++) { float randFloat = Random.Range(0f, 1f); if (randFloat < spawnChance) { spawnTree(i, j); } } } }
public void ConfirmBuild() { BuildingSystem buildNow = Instantiate(buildingCon, transform.position, transform.rotation) as BuildingSystem; buildNow.StartToBuild(thisOwner); Instantiate(constructSound, transform.position, transform.rotation); Destroy(this.gameObject); }
void UnselectBuilding() { if (selectedBuilding != null) { selectedBuilding.SetSelect(false); } selectedBuilding = null; }
private void Start() { instance = this; peerToPeerManager = multiplayerWorlds.GetComponent <PeerToPeerManager>(); blockSystem = GetComponent <BlockSystem>(); playerMove = player.GetComponent <PlayerMove>(); Debug.Log("Building System Initialized!"); }
public override bool OnStopUse(GameObject playerObj) { BuildingSystem buildingSystem = playerObj.GetComponent <BuildingSystem>(); buildingSystem.buildmode.interrupt(); return(true); }
void Awake() { isMultiplayer = Scenes.getParam("multiplayer") == "true"; buildingSystemScript = BuildingSystem.instance; inventoryScript = Inventory.instance; pauseMenuScript = PauseMenuScript.instance; chatClientScript = ChatClient.instance; }
public IList <BuildingSystem> GetAll() { if ((from t in _connection.Table <BuildingSystem>() select t).ToList().Count == 0) { tblBuildingSystem tblbs = new tblBuildingSystem(); BuildingSystem bs = new BuildingSystem(); bs.BuildingSystemName = "Structural"; bs.createon = DateTime.Now; tblbs.Add(bs); bs = new BuildingSystem(); bs.BuildingSystemName = "Exterior Walls"; bs.createon = DateTime.Now; tblbs.Add(bs); bs = new BuildingSystem(); bs.BuildingSystemName = "Roofing"; bs.createon = DateTime.Now; tblbs.Add(bs); bs = new BuildingSystem(); bs.BuildingSystemName = "Interior Finishes"; bs.createon = DateTime.Now; tblbs.Add(bs); bs = new BuildingSystem(); bs.BuildingSystemName = "Plumbing"; bs.createon = DateTime.Now; tblbs.Add(bs); bs = new BuildingSystem(); bs.BuildingSystemName = "HVAC"; bs.createon = DateTime.Now; tblbs.Add(bs); bs = new BuildingSystem(); bs.BuildingSystemName = "Electrical"; bs.createon = DateTime.Now; tblbs.Add(bs); bs = new BuildingSystem(); bs.BuildingSystemName = "Life Safety"; bs.createon = DateTime.Now; tblbs.Add(bs); bs = new BuildingSystem(); bs.BuildingSystemName = "FFE"; bs.createon = DateTime.Now; tblbs.Add(bs); bs = new BuildingSystem(); bs.BuildingSystemName = "Site Improvements"; bs.createon = DateTime.Now; tblbs.Add(bs); } return((from t in _connection.Table <BuildingSystem>() select t).ToList()); }
private void Awake() { if (instanceOfBuildsingSystem != null) { Debug.Log("more than one BuildingSystem in scene"); return; } instanceOfBuildsingSystem = this; }
private void Start() { gameManager = GameObject.FindGameObjectWithTag("GameController"); if (gameManager == null) { Debug.Log("we miss a tag / or we miss the game Manager whole"); } buildingSystem = gameManager.GetComponent <BuildingSystem>(); }
void Awake() { if (Instance != null) { DestroyImmediate(Instance); } else { Instance = this; } }
//When the game starts, get connections to both systems private void Start() { BuildingScriptSystem = gameObject.GetComponent <BuildingSystem>(); PlacementScriptSystem = GameObject.Find("PlaceablesPlacementController").GetComponent <PlacementController>(); BuildModeButton = GameObject.Find("ButtonSystemSwitcherBuilding"); PlaceableModeButton = GameObject.Find("ButtonSystemSwitcherPlacing"); SwitchToBuildMode(true); }
public BuildViewController(BuildingSystem buildingSystem, InventorySystem inventorySystem, BuildConfig buildConfig) { _buildingSystem = buildingSystem; _inventorySystem = inventorySystem; _buildConfig = buildConfig; _uiSpawnData = inventorySystem.GetSpawnData(); viewFactory.CreateAsync <BuildView>("GUI/BuildView", (v) => { view = v; SetVisible(_isVisible); OnCreationComplete(); }); }
void Awake() { if (instance != null) { Destroy(gameObject); return; } instance = this; selectionSystem = GetComponent <SelectionSystem>(); unitSystem = GetComponent <UnitSystem>(); gridSystem = GetComponent <GridSystem>(); resourceSystem = GetComponent <ResourceSystem>(); xpSystem = GetComponent <XpSystem>(); buildingSystem = GetComponent <BuildingSystem>(); }
private IEnumerator Dies() { if (uniType == UnitObjectType.Units) { Animator ani = GetComponent <Animator>(); ani.SetBool("Alive", false); } else { BuildingSystem build = GetComponent <BuildingSystem>(); build.DestroyNow(); } yield return(new WaitForSeconds(deadTime)); Destroy(this.gameObject); yield return(null); }
public void StartDummy(GameObject mod, BuildingSystem bui, int owner, int cos) { buildingCon = bui; thisOwner = owner; cost = cos; VRPlayerIndicator player = null; foreach (GameObject plays in GameObject.FindGameObjectsWithTag("Player")) { VRPlayerIndicator ind = plays.GetComponent <VRPlayerIndicator>(); if (ind.GetPlayerNumber() == thisOwner) { player = ind; } } player.ChangeEther(-cost); models = Instantiate(mod, this.transform) as GameObject; }
// Use this for initialization void Start() { BuildSys = GetComponent <BuildingSystem>(); if (BuildSys == null) { Debug.LogError("Building System not found on player object"); } else { BuildSys.buildingGroups = buildingFactionGroups.buildingFactionDictionary[(Factions)factionIndex]; } if (isLocalPlayer == false) { //This object belongs to another player. return; } if (DragSelectionHandler.singleton.playerObject == null) { DragSelectionHandler.singleton.AssignPlayerObject(this); } //Setup Systems UnitSys = GetComponent <UnitSystem>(); if (BuildSys == null) { Debug.LogError("Unit System not found on player object"); } else { BuildSys.buildingGroups = buildingFactionGroups.buildingFactionDictionary[(Factions)factionIndex]; } gameObject.name = gameObject.name + "NID" + GetComponent <NetworkIdentity> ().netId; Debug.Log("PlayerObject::Start -- Spawning my own personal Unit"); cam = Camera.main; }
public void AddNewBuildingSystem(string phaseName) { var phase = Phases.SingleOrDefault(p => p.PhaseName == phaseName); if (phase != null) { BuildingSystem bs = new BuildingSystem { FullName = "TBD", ActualBoardFeet = 0, Code = "TBD", EstimatedBoardFeet = 0 }; phase.BuildingSystems.Add(bs); } var lister = new List <Phase>(); Phases.ForEach(p => lister.Add(p)); Phases.Clear(); Phases = new ObservableCollection <Phase>(lister); OnPropertyChanged(nameof(Phases)); }
void Start() { instance = this; Debug.Log("Initializing inventory"); buildingSystem = GameObject.FindGameObjectWithTag("BlockManager").GetComponent <BuildingSystem>(); //Debug.Log("got BuildingSystem"); blockSystem = GameObject.FindGameObjectWithTag("BlockManager").GetComponent <BlockSystem>(); //Debug.Log("got BuildingSystem"); numAvailableSlots = Math.Min(totalSlots, blockSystem.allBlocks.Count); //numAvailableQuickSlots = Math.Min(totalQuickSlots, numAvailableSlots); numAvailableQuickSlots = totalQuickSlots; numOfCategories = categories.transform.childCount; slots = new Slot[numOfCategories, numAvailableSlots]; quickSlots = new Slot[numAvailableQuickSlots]; Debug.Log("All slots = " + numAvailableSlots + " quick slots = " + numAvailableQuickSlots); for (int i = 0; i < numAvailableSlots; i++) { slots[activeCategory, i] = slotHolder.transform.GetChild(i).GetComponent <Slot>(); slots[activeCategory, i].isQuickSlot = false; if (i < blockSystem.allBlocks.Count) { slots[activeCategory, i].SetItem(blockSystem.allBlocks[i]); } } /* * for (int i = numAvailableSlots; i < totalSlots; i++) * { * GameObject go = slotHolder.transform.GetChild(i).gameObject; * go.SetActive(false); * } */ Debug.Log("post slotHolder"); for (int i = 0; i < numAvailableQuickSlots; i++) { quickSlots[i] = quickInventory.transform.GetChild(i).GetComponent <Slot>(); quickSlots[i].isQuickSlot = true; quickSlots[i].slotIndex = i; if (i < blockSystem.allBlocks.Count) { quickSlots[i].SetItem(blockSystem.allBlocks[i]); } } /* * for (int i = numAvailableQuickSlots; i < totalQuickSlots; i++) * { * GameObject go = quickInventory.transform.GetChild(i).gameObject; * go.SetActive(false); * } */ Debug.Log("post quickSlots"); activeQuickSlot = quickSlots[0]; Image anImage = activeQuickSlot.GetComponent <Image>(); unselectedColor = anImage.color; anImage.color = selectedColor; Debug.Log("Initialize Done"); }
void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { if (pauseMenuActive) { ClosePauseMenu(); } else { OpenPauseMenu(); } if (pauseMenuScript == null) { pauseMenuScript = PauseMenuScript.instance; if (pauseMenuScript == null) { Debug.LogWarning("couldn't get pauseMenuScript instance!"); } } pauseMenuScript.TogglePauseMenu(); } if (pauseMenuActive) { return; } if (Input.GetKeyDown(KeyCode.Delete)) { if (chatMenuActive) { CloseChatMenu(); } else { OpenChatMenu(); } if (chatClientScript == null) { chatClientScript = ChatClient.instance; if (chatClientScript == null) { Debug.LogWarning("couldn't get chatClientScript instance!"); } } chatClientScript.ToggleChatMenu(); return; } if (oSD.activeSelf) { if (Input.GetKeyDown("t")) { if (buildingSystemScript == null) { buildingSystemScript = BuildingSystem.instance; if (buildingSystemScript == null) { Debug.LogWarning("couldn't get buildingSystemScript instance!"); } } buildingSystemScript.ToggleEditMode(); return; } if (Input.GetKeyDown(KeyCode.Tab)) { if (inventoryScript == null) { inventoryScript = Inventory.instance; if (inventoryScript == null) { Debug.LogWarning("couldn't get inventory instance!"); } } inventoryScript.ToggleInventory(); return; } } }
// Use this for initialization void Start() { build = GetComponent <BuildingSystem>(); stat = GetComponent <UnitStatSystem>(); }
public void Add(BuildingSystem buildingSys) { _connection.Insert(buildingSys); }
private static void Main() { var buildingSystem = new BuildingSystem(); buildingSystem.Create(); }
public BuildingModel GetModel(IModel model, IIfcBuildingStorey ignored = null) { Definitions <PropertySetDef> propertyDefinitions = null; // prepare standard properties dictionary if (IncludeStandardPsets) { switch (model.Header.SchemaVersion.ToLowerInvariant()) { case "ifc2x3": propertyDefinitions = new Definitions <PropertySetDef>(Xbim.Properties.Version.IFC2x3); break; case "ifc4": propertyDefinitions = new Definitions <PropertySetDef>(Xbim.Properties.Version.IFC2x3); break; default: break; } if (propertyDefinitions != null) { propertyDefinitions.LoadAllDefault(); } } // cache systems list // var elementToSystem = new Dictionary <int, int>(); var systemRels = model.Instances.OfType <IIfcRelAssignsToGroup>().Where(x => x.RelatingGroup is IIfcSystem ); foreach (var systemRel in systemRels) { foreach (var relatedObject in systemRel.RelatedObjects) { if (elementToSystem.ContainsKey(relatedObject.EntityLabel)) { continue; } elementToSystem.Add(relatedObject.EntityLabel, systemRel.RelatingGroup.EntityLabel); } } // now extract BuildingModel m = new BuildingModel(); List <IIfcBuildingStorey> storeys = new List <IIfcBuildingStorey>(); List <IIfcSystem> systems = new List <IIfcSystem>(); foreach (var ifcElement in model.Instances.OfType <IIfcElement>()) { if (CustomFilter != null) { var skip = CustomFilter(ifcElement.EntityLabel, model); if (skip) { continue; } } BuildingElement semanticElement = new BuildingElement(); semanticElement.SetBase(ifcElement); if (propertyDefinitions != null) { var thisClass = new ApplicableClass(); thisClass.ClassName = ifcElement.ExpressType.Name; var applicable = propertyDefinitions.DefinitionSets.Where(x => x.ApplicableClasses.Any(ac => ac.ClassName == thisClass.ClassName)); var psets = ifcElement.IsDefinedBy.Where(x => x.RelatingPropertyDefinition is IIfcPropertySet).Select(pd => pd.RelatingPropertyDefinition as IIfcPropertySetDefinition).ToList(); foreach (var definition in applicable) { var matchingSet = psets.Where(x => x.Name == definition.Name).FirstOrDefault(); if (matchingSet == null) { continue; } var ps = new ElementPropertySet(); ps.propertySetName = matchingSet.Name; foreach (var singleProperty in definition.PropertyDefinitions) { var pFound = GetProperty(matchingSet, singleProperty); if (!string.IsNullOrWhiteSpace(pFound)) { ps.properties.Add(new IfcInfo( singleProperty.Name, pFound )); } } if (ps.properties.Any()) { semanticElement.propertySets.Add(ps); } } } // storeys (prepares list and sets index, data extraction happens later) semanticElement.ifcStoreyIndex = GetStoreyId(ifcElement, storeys); if (semanticElement.ifcStoreyIndex == -1) { // try through upper level of aggregation (up from the aggregates to the RelatingObject) // foreach (var relAggreg in ifcElement.Decomposes.OfType <IIfcRelAggregates>()) { int found = GetStoreyId(relAggreg.RelatingObject as IIfcElement, storeys); if (found != -1) { semanticElement.ifcStoreyIndex = found; break; } } } // systems (prepares list and sets index, data extraction happens later) if (elementToSystem.ContainsKey(ifcElement.EntityLabel)) { var systemId = elementToSystem[ifcElement.EntityLabel]; var system = model.Instances[systemId] as IIfcSystem; if (system != null) { int index = systems.IndexOf(system); if (index == -1) { index = systems.Count; systems.Add(system); } semanticElement.ifcSystemIndex = index; } } // now add element m.elements.Add(semanticElement); } // data extraction for the dicionaries happens here foreach (var storey in storeys) { var s = new BuildingStorey( ToDouble(storey.Elevation) ); s.SetBase(storey); m.storeys.Add(s); } foreach (var system in systems) { var s = new BuildingSystem(); s.SetBase(system); m.systems.Add(s); } return(m); }
// Use this for initialization void Start() { SkirmishDataTransfer data = FindObjectOfType <SkirmishDataTransfer>(); if (data != null) { maxPlayer = data.GetMaxPlayer(); playerActive = data.GetAssignPlayer(); factions = data.GetFaction(); playerTeam = data.GetTeam(); //Spawn Player for (int i = 0; i < maxPlayer; i++) { if (playerActive[i]) { if (i >= 1) { GameObject aiOBJ = Instantiate(AIDummy, transform.position, transform.rotation) as GameObject; VRPlayerIndicator ai = aiOBJ.gameObject.GetComponent <VRPlayerIndicator>(); ai.SetPlayerNum(i + 1); } VRPlayerIndicator player = null; foreach (GameObject plays in GameObject.FindGameObjectsWithTag("Player")) { VRPlayerIndicator ind = plays.GetComponent <VRPlayerIndicator>(); if (ind.GetPlayerNumber() == i + 1) { player = ind; } } player.SetEther(1500); player.transform.position = startPosition[i].transform.position - (Vector3.forward * 20); if (factions[i] == SkirmishScreenSelection.FactionType.Chaiya) { BuildingSystem strong = Instantiate(chaiyaStrong, startPosition[i].transform.position, startPosition[i].transform.rotation) as BuildingSystem; strong.StartToBuild(i + 1); } if (factions[i] == SkirmishScreenSelection.FactionType.Ulepia) { BuildingSystem strong = Instantiate(ulepiaStrong, startPosition[i].transform.position, startPosition[i].transform.rotation) as BuildingSystem; strong.StartToBuild(i + 1); } if (factions[i] == SkirmishScreenSelection.FactionType.Shin) { BuildingSystem strong = Instantiate(shinStrong, startPosition[i].transform.position, startPosition[i].transform.rotation) as BuildingSystem; strong.StartToBuild(i + 1); } } } //Ally Set for (int i = 0; i < maxPlayer; i++) { for (int j = 0; j < maxPlayer; j++) { if (i != j && playerTeam[i] == playerTeam[j]) { AllianceSystem.SetAlly(i + 1, j + 1, true); } } } data.SetTransfered(true); } else { } }
public void Update(BuildingSystem buildingSys) { _connection.Update(buildingSys); }