public void AddController(AController c) { if (c is PlayerController) { player = (PlayerController)c; } else if (c is AudioManager) { audioManager = (AudioManager)c; } else if (c is SlotsController) { slotsController = (SlotsController)c; } else if (c is UIController) { uiController = (UIController)c; } else if (c is RoundController) { roundController = (RoundController)c; } //else if (c is CheckpointController) //checkpointController = (CheckpointController)c; }
// Start is called before the first frame update void Start() { gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <SlotsController>(); lastInventoryPosition = this.transform.position; lastSlotParent = this.transform.parent; _slotStoragePiece = transform.GetComponentInParent <Slot>(); canvasGroup = GetComponent <CanvasGroup>(); }
public void ResetArsenals(SlotsController slotsC) { slotsC.arsenalsLootable.Clear(); foreach (Arsenal a in slotsC.arsenals) { a.totalEffect = a.initialEffect; slotsC.arsenalsLootable.Add(a.myName); } }
public void ResetGearSlots(SlotsController slotsC) { foreach (Slot s in slotsC.slots) { if (s.slot.transform.childCount > 0) { GearController slotsGear = s.slot.transform.GetChild(0).GetComponent <GearController>(); if (slotsGear != null) { s.gear = slotsGear; s.slotEmpty = false; s.SetName(s.gear.name); s.gear.gameObject.SetActive(false); } else { Debug.Log("Child(0) of this slot is not a gear !"); s.slotEmpty = true; s.SetName("Empty Slot"); } } else { s.slotEmpty = true; s.SetName("Empty Slot"); } } slotsC.slotIndex = 0; slotsC.activeSlot = slotsC.slots[slotsC.slotIndex]; if (slotsC.activeSlot.slot.transform.childCount > 0 && !slotsC.activeSlot.slotEmpty) { slotsC.activeSlot.gear.gameObject.SetActive(true); slotsC.activeSlot.gear.enabled = true; if (slotsC.activeSlot.gear.gearType == GearType.Weapon) { slotsC.activeWeapon = slotsC.activeSlot.gear as Weapon; slotsC.activeConsumable = null; slotsC.ApplyArsenalToGear(); } else if (slotsC.activeSlot.gear.gearType == GearType.Consumable) { slotsC.activeConsumable = slotsC.activeSlot.gear as Consumable; slotsC.activeWeapon = null; } ActivateHudGear(slotsC.activeSlot.gear); } }
private async Task CreateSlotsAsync() { var slots = new List <SlotModel>(); var c = new SlotsController(_context); foreach (var project in projects) { foreach (var week in weeks) { foreach (var activity in activities) { if (activity.ActivityID >= 1 && activity.ActivityID <= 17) // create one for all these activites { slots.Add(new SlotModel { ProjectID = project.ProjectID, WeekID = week.WeekID, ActivityID = activity.ActivityID, EmployeeID = "_" + 1 }); } if (activity.ActivityID >= 8 && activity.ActivityID <= 12) // morning emergency - create an extra { slots.Add(new SlotModel { ProjectID = project.ProjectID, WeekID = week.WeekID, ActivityID = activity.ActivityID, EmployeeID = "_" + 2 }); } if (activity.ActivityID >= 18 && activity.ActivityID <= 27) { for (int i = 1; i <= 5; i++) // create 5 of each counseling activity { slots.Add(new SlotModel { ProjectID = project.ProjectID, WeekID = week.WeekID, ActivityID = activity.ActivityID, EmployeeID = "_" + i }); } } } } } await _context.Slot.AddRangeAsync(slots).ConfigureAwait(false); }
private void Awake() { //Get controllers me = this; canvasObject = GameObject.Find("GeneralCanvas"); canvasManager = canvasObject.GetComponent <CanvasManager>(); menuInteract = canvasObject.GetComponent <MenuInteract>(); playerObject = GameObject.Find("FirstPersonPlayer"); playerBody = playerObject.GetComponent <CharacterController>(); playerController = playerObject.GetComponent <PlayerController>(); playerCam = playerObject.GetComponentInChildren <Camera>(); playerView = playerObject.GetComponentInChildren <PlayerView>(); audioManager = FindObjectOfType <AudioManager>(); dialogManager = FindObjectOfType <DialogManager>(); slotsController = FindObjectOfType <SlotsController>(); canvasManager.gameManager = me; canvasManager.menuInteract = menuInteract; menuInteract.canvasManager = canvasManager; //Get game objects miniMapCam = GameObject.Find("MinimapCam").GetComponent <Camera>(); miniMapController = miniMapCam.GetComponent <MiniMapController>(); gearsInLevel = GameObject.Find("GearsInLevel"); shopObject = GameObject.Find("Shop"); initialGearPosition1 = GameObject.Find("InitialGear1").transform.position; initialGearPosition2 = GameObject.Find("InitialGear2").transform.position; initialGearPosition3 = GameObject.Find("InitialGear3").transform.position; gearPosition1 = GameObject.Find("Gear1Position").transform.position; gearPosition2 = GameObject.Find("Gear2Position").transform.position; gearPosition3 = GameObject.Find("Gear3Position").transform.position; gearPosition4 = GameObject.Find("Gear4Position").transform.position; bossPandaPosition = GameObject.Find("BossPandaSpawnPoint").transform.position; bossMammothPosition = GameObject.Find("BossMammothSpawnPoint").transform.position; level1 = GameObject.Find("Level1").GetComponent <LevelBuilder>(); level2 = GameObject.Find("Level2").GetComponent <LevelBuilder>(); introCinematique = FindObjectOfType <VideoPlayer>(); gearSlot1 = GameObject.Find("GearSlot1"); gearSlot2 = GameObject.Find("GearSlot2"); gearSlot3 = GameObject.Find("GearSlot3"); //Get HUD barArmor = GameObject.Find("Armor Bar").GetComponent <HUDBar>(); barHealth = GameObject.Find("Health Bar").GetComponent <HUDBar>(); textArmor = GameObject.Find("Current Armor").GetComponent <HUDText>(); textHealth = GameObject.Find("Current Health").GetComponent <HUDText>(); textMoney = GameObject.Find("Current Money").GetComponent <HUDText>(); weaponHUD = GameObject.Find("HUDWeapon"); textMunitions = GameObject.Find("Munitions").GetComponent <HUDText>(); textCapacity = GameObject.Find("Capacity").GetComponent <HUDText>(); weaponHUD.SetActive(false); consumableHUD = GameObject.Find("HUDConsumable"); textConsumablesRemaining = consumableHUD.GetComponentInChildren <HUDText>(); consumableHUD.SetActive(false); textSlot1 = GameObject.Find("TextSlot 1").GetComponent <HUDText>(); textSlot2 = GameObject.Find("TextSlot 2").GetComponent <HUDText>(); textSlot3 = GameObject.Find("TextSlot 3").GetComponent <HUDText>(); //Get Teleporters tpToLevel1FromTuto = GameObject.Find("tpToLevel1FromTuto").transform; tpToTutoFromLevel1 = GameObject.Find("tpToTutoFromLevel1").transform; tpToLevel1FromArena1 = GameObject.Find("tpToLevel1FromArena1").transform; tpToMarketFromArena1 = GameObject.Find("tpToMarketFromArena1").transform; tpToMarketFromArena1.gameObject.SetActive(false); tpToArena1FromMarket = GameObject.Find("tpToArena1FromMarket").transform; tpToLevel2FromMarket = GameObject.Find("tpToLevel2FromMarket").transform; tpToMarketFromLevel2 = GameObject.Find("tpToMarketFromLevel2").transform; tpToLevel2FromArena2 = GameObject.Find("tpToLevel2FromArena2").transform; introCinematique.Play(); //Set Layer Masks groundMask = 256; enemiesMask = 512; playerMask = 1024; gearMask = 2048; tpMask = 4096; npcMask = 8192; playerSpawnPoint = playerController.transform.position; InitializePlayer(); dialogManager.gameManager = me; playerView.gameManager = me; miniMapController.player = playerBody.transform; slotsController.gameManager = me; gearsInGame = new List <GearController>(); enemies = new List <EnemyStats>(); npcInGame = new List <NPC>(); EnemyStats[] initialEnemies = FindObjectsOfType <EnemyStats>(); foreach (EnemyStats enemy in initialEnemies) { InitializeEnemy(enemy); } NPC[] initialNPCs = FindObjectsOfType <NPC>(); foreach (NPC npc in initialNPCs) { InitializeNPC(npc); } canvasManager.InitiateCanvas(playerController); StartCoroutine("CheckIfIntroFinished"); }