void Start() { canvas = GameObject.Find("Canvas").GetComponentInChildren <Canvas>(); characterInventory = canvas.GetComponentInChildren <CharacterInventoryGUI>(); terrain = GameObject.FindWithTag("MainEnvironment").GetComponentInChildren <TerrainScript>(); inventoryWindow = characterInventory.GetComponentInChildren <CharacterInventoryPickupWindowGUI>(); Weapons = terrain.Player.GetComponentInChildren <WeaponsDatabase>(); Armors = terrain.Player.GetComponentInChildren <ArmorDatabase>(); wepSwitch = terrain.Player.GetComponentInChildren <WeaponSwitch>(); armorSwitch = terrain.Player.GetComponentInChildren <ArmorSwitch>(); Stats = terrain.Player.GetComponentInChildren <CharacterStats>(); mainGUI = canvas.GetComponent <MainGUI>(); movement = terrain.Player.GetComponentInChildren <CharacterMovement>(); characterGUI = canvas.GetComponentInChildren <CharacterSkillBarGUI>(); CurrentItemLocationIndex = -1; PreviousUpgradedIcon = transform.Find("ParentUpgradeItemPrevious").Find("UpgradeItemPrevious").gameObject; AfterUpgradedIcon = transform.Find("ParentUpgradeItemAfter").Find("UpgradeItemAfter").gameObject; transform.Find("Confirm").GetComponent <Button>().onClick.AddListener(() => CreateRarity()); HoverRectINIT = Instantiate(HoverWindowRectPrefab, transform.position, transform.rotation) as GameObject; HoverRectINIT.transform.SetParent(transform); HoverRectINIT.transform.localScale = new Vector3(1, 1, 1); HoverRectINIT.GetComponentInChildren <Image>().enabled = false; HoverRectINIT.transform.Find("Image").GetComponentInChildren <Text>().enabled = false; HoverRectINIT.transform.Find("Image").Find("Level").GetComponent <Text>().enabled = false; HoverRectINIT.transform.Find("Image").Find("Rarity").GetComponent <Text>().enabled = false; HoverRectINIT.transform.Find("Image").Find("Rate1").GetComponent <Text>().enabled = false; HoverRectINIT.transform.Find("Image").Find("Rate2").GetComponent <Text>().enabled = false; HoverRectINIT.transform.Find("Image").Find("Rate3").GetComponent <Text>().enabled = false; HoverRectINIT.transform.Find("Image").Find("Rate4").GetComponent <Text>().enabled = false; HoverRectINIT.transform.Find("Image").Find("Rate5").GetComponent <Text>().enabled = false; }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player") && charBoost) { StartCoroutine(PickUp(other)); } if (other.CompareTag("Player") && axeBoost) { WeaponSwitch switchWep = other.GetComponentInChildren <WeaponSwitch>(); switchWep.SwitchToThisWep(0); StartCoroutine(PickUp(other)); } if (other.CompareTag("Player") && swordBoost) { WeaponSwitch switchWep = other.GetComponentInChildren <WeaponSwitch>(); switchWep.SwitchToThisWep(1); StartCoroutine(PickUp(other)); } if (other.CompareTag("Player") && spellBoost) { WeaponSwitch switchWep = other.GetComponentInChildren <WeaponSwitch>(); switchWep.SwitchToThisWep(2); StartCoroutine(PickUp(other)); } }
void Start() { terrain = GameObject.FindWithTag("MainEnvironment").GetComponentInChildren <TerrainScript>(); InventoryManage = new List <InventoryManager>(); Debug.Log("inv spawned"); DroppedItemList = new List <InventoryManager>(); EquipWeapon = terrain.Player.GetComponentInChildren <WeaponsDatabase>(); EquipArmor = terrain.Player.GetComponentInChildren <ArmorDatabase>(); SwitchWeapons = terrain.Player.GetComponentInChildren <WeaponSwitch>(); SwitchArmor = terrain.Player.GetComponentInChildren <ArmorSwitch>(); Stats = terrain.Player.GetComponentInChildren <CharacterStats>(); MiscItems = terrain.Player.GetComponentInChildren <MiscellaneousItemsDatabase>(); ToolItems = terrain.Player.GetComponentInChildren <ToolDatabase>(); RockOre = terrain.Player.GetComponentInChildren <MineRocks>(); TreeLog = terrain.Player.GetComponentInChildren <ChopTrees>(); Herbs = terrain.Player.GetComponentInChildren <Herbloring>(); ItemsPickup = terrain.Player.GetComponentInChildren <PickupObjects>(); Potions = terrain.Player.GetComponentInChildren <PotionDatabase>(); movement = terrain.Player.GetComponentInChildren <CharacterMovement>(); skillbarGUI = terrain.canvas.GetComponent <MainGUI>().characterSkillsBarGUI; Invoke("TestingPurposes", 4); InvokeRepeating("CombineStacks", 4, 3); }
void Awake() { enemySpawnPoints = null; remainingEnemies = null; actionText = GameObject.Find("ActionInfo").GetComponent <Text>(); actionText.text = ""; blueAmmo = fastHands.GetComponent <NormalHands>().ammoCount; pinkAmmo = normalHands.GetComponent <NormalHands>().ammoCount; violetAmmo = megaHands.GetComponent <MegaHands>().rocketsAmount; weaponSwitch = FindObjectOfType <WeaponSwitch>(); playMusic = FindObjectOfType <PlayMusic>(); lightSwitch = FindObjectOfType <LightColorSwitch>(); bgColor = FindObjectOfType <BGColorSwitch>(); startOp = FindObjectOfType <StartOptions>(); playerMove = FindObjectOfType <PlayerMovement>(); endText.enabled = false; enemyCountdown.enabled = false; smileyCheck.enabled = false; pizzaCheck.enabled = false; alienCheck.enabled = false; gameOverButtons.SetActive(false); }
void Start() { weaponSwitch = FindObjectOfType <WeaponSwitch>(); cam = GetComponent <Camera>(); currentColor = cam.backgroundColor; nextColor = currentColor; }
void Start() { playerProperties = transform.root.gameObject.GetComponent <PlayerProperties>(); damage = playerProperties.quickMeleeDamage; weaponSwitch = transform.root.gameObject.GetComponent <WeaponSwitch>(); quickMeleeCollider = GetComponent <BoxCollider>(); control = playerProperties.gameObject.GetComponent <PlayerInputControls>(); }
// Use this for initialization #region Start void Start() { properties = GetComponent <PlayerProperties>(); controller = GetComponent <CharacterController> (); stamina = GetComponent <Stamina>(); weaponSwitch = GetComponent <WeaponSwitch>(); control = GetComponent <PlayerInputControls>(); }
void Start() { weaponSwitch = FindObjectOfType <WeaponSwitch>(); light = GetComponent <Light>(); currentColor = light.color; nextColor = currentColor; }
private void Start() { aud = GetComponent <AudioSource>(); weaponSwitch = GetComponent <WeaponSwitch>(); playerController = GetComponent <PlayerControllerSinglePlayer>(); gunAimUp = GetComponent <GunAimUpSinglePlayer>(); playerHealth = GetComponent <HealthSinglePlayer>(); pauseGame = GetComponent <PauseGame>(); }
private void Awake() { if (instance != null) { Debug.Log("Il y a plus d'une instance de WeaponSwitch dans la scene!"); return; } instance = this; }
// Use this for initialization void Start() { if (player == null) { player = transform.root.gameObject; } currentText = GetComponent <Text>(); weaponSwitch = player.GetComponent <WeaponSwitch>(); }
private void CreateServerHUD() { HudElem WeaponSwitch; WeaponSwitch = HudElem.CreateServerFontString("default", 1.5f); WeaponSwitch.SetPoint("center", "center", -20, 230); WeaponSwitch.HideWhenInMenu = true; WeaponSwitch.Archived = false; WeaponSwitch.SetText("^2Press ^1[{+actionslot 1}] ^2for NoClip!^2Press ^1[{+actionslot 2}] ^2for save Pos!"); }
public void SMGCraft() { PickedItemCanvas.SetActive(true); CanvasTextMainUIPickedItemInfo = GameObject.Find("PickedItemInfo").GetComponent <Text>(); SMGCraftButton = GameObject.Find("CraftButton").GetComponent <Button>(); WeaponSwitch = MainCamera.GetComponent <WeaponSwitch>(); CanvasTextMainUIPickedItemInfo.text = "SMG"; WeaponSwitch.HaveSMG = true; SMGCraftButton.interactable = false; }
private void OnTriggerStay(Collider other) { if (other.gameObject.name == "Player") { WeaponSwitch weaponSwitch = other.gameObject.GetComponentInChildren <WeaponSwitch>(); weaponSwitch.SendMessage("AddWeapon", weaponType); FindObjectOfType <ShowItemBars>().CleanText(); Destroy(gameObject); } }
// Use this for initialization void Start() { weaponSwitch = transform.root.GetComponent <WeaponSwitch>(); inventory = transform.root.GetComponent <PlayerInventory>(); attachmentsInInventory = new List <Attachment>(); attachmentInventoryIndex = new List <int>(); attachmentButtons = new List <Button>(); attachmentImages = new List <Image>(); weaponButtons = new List <Button>(); weaponImages = new List <Image>(); }
void Start() { weaponSwitch = GetComponent <WeaponSwitch>(); equippedWeapons = new Weapon1[weaponSwitch.maxWeapons]; pause = GetComponent <PauseGame>(); control = GetComponent <PlayerInputControls>(); if (chestDisplay == null) { chestDisplay = transform.GetComponentInChildren <DisplayChestContents>(); } }
void Start() { characterController = GetComponent <CharacterController>(); playerCamera = GetComponentInChildren <Camera>().transform; sfx = GetComponent <SfxHelper>(); weaponSwitcher = GetComponentInChildren <WeaponSwitch>(); Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; StartCoroutine(PlayFootsteps()); }
void Start() { movement = gameObject.GetComponentInChildren <CharacterMovement>(); MiscItems = gameObject.GetComponentInChildren <MiscellaneousItemsDatabase>(); GatheringSkill = gameObject.GetComponentInChildren <GatheringSkillDatabase>(); terrain = GameObject.FindGameObjectWithTag("MainEnvironment").GetComponent <TerrainScript>(); Stats = gameObject.GetComponentInChildren <CharacterStats>(); ItemPickup = gameObject.GetComponentInChildren <PickupObjects>(); characterInventory = terrain.canvas.GetComponentInChildren <CharacterInventoryGUI>(); mainGUI = terrain.canvas.GetComponentInChildren <MainGUI>(); ItemID = transform.GetComponentInChildren <WeaponSwitch>(); }
void Start() { WS = GetComponent <WeaponSwitch> (); rb = GetComponent <Rigidbody> (); //MovementInputValue = 0f; //TurnInputValue = 0f; //MovementAxisName = "Vertical"; //TurnAxisName = "Horizontal"; RaiseShield = false; PlayerCamera.SetActive(true); Shield.SetActive(false); WS.enabled = true; }
private void OnTriggerEnter(Collider other) { if (other.tag == "WeaponTrigger") { if (this.name == "Hand1") { WeaponSwitch.SetHand1InCollider(true); } else if (this.name == "Hand2") { WeaponSwitch.SetHand2InCollider(true); } } }
// Use this for initialization void Start() { aud = GetComponent <AudioSource>(); player = transform.root.gameObject; weaponSwitch = player.GetComponent <WeaponSwitch>(); gunAnim = GetComponent <Animator>(); updateAmmo = player.transform.Find("SinglePlayer UI/HUD/Ammo Count").GetComponent <UpdateAmmo>(); if (ammoAmount == null) { ammoAmount = transform.Find("Ammo").GetComponent <Amount>(); } cam = player.transform.Find("Camera").GetComponent <Camera>(); playerPropterties = player.GetComponent <PlayerProperties>(); }
// When the game starts, or when the gun is initialized onto the player #region Start Function public override void Start() { base.Start(); if (isPickup) { return; } if (ammoAmount == null) { ammoAmount = transform.Find("Ammo").GetComponent <Amount>(); } weaponSwitch = player.GetComponent <WeaponSwitch>(); }
private void Start() { reticleCheck = GameObject.Find("Crosshair").GetComponent <Reticle>(); fpsCam = GameObject.Find("CameraMain"); hitMarkerImage = GameObject.Find("UI/Hitmarker/Image").GetComponent <Image>(); hitMarkerImage.color = CLEARWHITE; playerInput = transform.GetComponentInParent <PlayerInput>(); switchParent = transform.GetComponentInParent <WeaponSwitch>(); UpdateWeaponStats(); startPos = transform.localPosition; startRot = transform.localRotation; //Sound sfx.PlayOneShot(equipSound, 1f); }
public static void Load(string playerName) { string path = playerName + "/savegame.dat"; if (File.Exists(Application.persistentDataPath + path)) { CharacterStats charSt = FindObjectOfType <CharacterStats>(); Debug.Log("Load"); BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/" + playerName + "savegame.dat", FileMode.Open); CharacterData data = (CharacterData)bf.Deserialize(file); file.Close(); //TODO : Lataa arvot ScoreTable.currentPlayer = data.name; ScoreTable.SetScore(ScoreTable.currentPlayer, "score", data.score); CharacterStats.currentCharacterLevel = data.cCharLevel; CharacterStats.levelPojo = data.lPojo; CharacterStats.strength = data.str; CharacterStats.dexterity = data.dex; CharacterStats.vitality = data.vit; CharacterStats.energy = data.ene; charSt.maxHealth = data.mHealth; charSt.maxMana = data.mMana; charSt.replenishH = data.rHealth; charSt.replenishM = data.rMana; charSt.moveSpeed = data.fMoveSpeed; charSt.rotationSpeed = data.rotSpeed; charSt.BackwardsMoveSpeed = data.bMoveSpeed; charSt.jumpForce = data.jForce; Level1 = data._Level1; Level2 = data._Level2; Level3 = data._Level3; Level4 = data._Level4; Level5 = data._Level5; WeaponSwitch wep = FindObjectOfType <WeaponSwitch>(); wep.SwitchToThisWep(0); FindObjectOfType <Axe>().LoadAxeStats(); wep.SwitchToThisWep(1); FindObjectOfType <Sword>().LoadSwordStats(); wep.SwitchToThisWep(2); FindObjectOfType <Spell>().LoadSpellStats(); } }
// Use this for initialization public override void Start() { base.Start(); switch (howToReload) { case ReloadType.AsSoonAsMagazineIsEmpty: asSoonAsMagEmpty = true; break; case ReloadType.OnlyWhenButtonIsPressed: whenButtonPressed = true; break; case ReloadType.WhenTryingToFireAnEmptyMagazine: whenFiringEmptyMag = true; break; } weaponSwitch = player.GetComponent <WeaponSwitch>(); }
void OnTriggerEnter(Collider col) { if (col.tag == "Player") { WeaponSwitch script = col.gameObject.GetComponent <WeaponSwitch> (); if (WeaponId == WeaponID.RPG) { script.RPG = true; script.GameObjects [0].SetActive(false); script.GameObjects [1].SetActive(false); script.GameObjects [2].SetActive(true); } if (WeaponId == WeaponID.Riffle) { script.Riffle = true; script.GameObjects [0].SetActive(false); script.GameObjects [1].SetActive(true); script.GameObjects [2].SetActive(false); } Destroy(gameObject); } }
private void OnTriggerStay(Collider other) { if (!other.CompareTag("Player")) { return; } GameObject player = other.transform.root.gameObject; WeaponSwitch weaponSwitch = player.GetComponent <WeaponSwitch>(); PlayerInventory inventory = player.GetComponent <PlayerInventory>(); switch (questType) { case QuestType.PickupWeapon: for (int i = 0; i < weaponSwitch.hands.childCount; i++) { if (weaponToPickup.name == weaponSwitch.hands.GetChild(i).name) { CompleteQuest(player); break; } } break; case QuestType.PickupKey: if (inventory.keyNumbers.Contains(keytoPickup.keyNumber)) { CompleteQuest(player); } break; case QuestType.PickupItem: if (inventory.inventory.Contains((Item)itemToPickup)) { CompleteQuest(player); } break; } }
void Awake() { Stats = gameObject.GetComponentInChildren <CharacterStats>(); wepswitch = gameObject.GetComponentInChildren <WeaponSwitch>(); GeneralSkillList.Add(GSkill1); GeneralSkillList.Add(GSkill2); GeneralSkillList.Add(GSkill3); GeneralSkillList.Add(GSkill4); GeneralSkillList.Add(GSkill5); GeneralSkillList.Add(GSkill6); GeneralSkillList.Add(GSkill7); FireSkillList.Add(FSkill1); IceSkillList.Add(ISkill1); LightningSkillList.Add(LSkill1); NatureSkillList.Add(NSkill1); GeneralSkills = new GameObject[GeneralSkillsPrefab.Length]; FireSkills = new GameObject[FireSkillsPrefab.Length]; IceSkills = new GameObject[IceSkillsPrefab.Length]; LightningSkills = new GameObject[LightningSkillsPrefab.Length]; NatureSkills = new GameObject[NatureSkillsPrefab.Length]; }
// Use this for initialization void Start() { if (gameObject.name != "Ammo Count Panel") { Debug.LogWarning("Make sure this is attached to a panel with ammo dislpay UI objects in it!"); } Image[] tempImages = GetComponentsInChildren <Image>(); ammoImage = new Image[tempImages.Length - 1]; for (int i = 1; i < tempImages.Length; i++) { ammoImage[i - 1] = tempImages[i]; } amountText = GetComponentsInChildren <Text>(); try { ammo = transform.root.GetComponent <PlayerAmmo>(); } catch (MissingComponentException e) { Debug.LogError("Missing a player ammo in the root transform!!"); } weaponSwitch = transform.root.GetComponent <WeaponSwitch>(); }
void Start() { CurrentPointerButtonIndex = -1; CurrentUpgradeItemSlot = -1; UpgradeIndex = -1; terrain = GameObject.FindWithTag("MainEnvironment").GetComponentInChildren <TerrainScript>(); RectINIT = Instantiate(PickUpWindowRectPrefab, transform.position, transform.rotation) as Button; RectINIT.GetComponentInChildren <Image>().enabled = false; HoverRectINIT = Instantiate(HoverWindowRectPrefab, transform.position, transform.rotation) as GameObject; HoverRectINIT.transform.SetParent(transform); HoverRectINIT.transform.localScale = new Vector3(1, 1, 1); HoverRectINIT.GetComponentInChildren <Image>().enabled = false; HoverRectINIT.transform.Find("Image").GetComponentInChildren <Text>().enabled = false; HoverRectINIT.transform.Find("Image").Find("Level").GetComponentInChildren <Text>().enabled = false; HoverRectINIT.transform.Find("Image").Find("Rarity").GetComponentInChildren <Text>().enabled = false; HoverRectINIT.transform.Find("Image").Find("Rate1").GetComponentInChildren <Text>().enabled = false; HoverRectINIT.transform.Find("Image").Find("Rate2").GetComponentInChildren <Text>().enabled = false; HoverRectINIT.transform.Find("Image").Find("Rate3").GetComponentInChildren <Text>().enabled = false; HoverRectINIT.transform.Find("Image").Find("Rate4").GetComponentInChildren <Text>().enabled = false; HoverRectINIT.transform.Find("Image").Find("Rate5").GetComponentInChildren <Text>().enabled = false; inventory = gameObject.transform.root.GetComponentInChildren <Canvas>(); characterInventory = gameObject.GetComponentInParent <CharacterInventoryGUI>(); skillbarGUI = terrain.canvas.GetComponentInChildren <CharacterSkillBarGUI>(); character = terrain.Player.GetComponentInChildren <CharacterMovement>(); MiscItems = terrain.Player.GetComponentInChildren <MiscellaneousItemsDatabase>(); Weapons = terrain.Player.GetComponentInChildren <WeaponsDatabase>(); WepSwitch = terrain.Player.GetComponentInChildren <WeaponSwitch>(); Tools = terrain.Player.GetComponentInChildren <ToolDatabase>(); Potions = terrain.Player.GetComponentInChildren <PotionDatabase>(); Armors = terrain.Player.GetComponentInChildren <ArmorDatabase>(); armorSwitch = terrain.Player.GetComponentInChildren <ArmorSwitch>(); Stats = terrain.Player.GetComponentInChildren <CharacterStats>(); UpgradeItems = terrain.canvas.GetComponentInChildren <CharacterUpgradeItems>(); }