public void PlayerPickedupPowerUP(PickupTypes pickup, int playerNumber) { switch (pickup) { case PickupTypes.LongBlast: e_playerPickups[playerNumber].bombBlastRadius++; print("LongBlast"); break; case PickupTypes.MoreBombs: e_playerPickups[playerNumber].bombAmount++; print("MoreBombs"); break; case PickupTypes.RCBomb: e_playerPickups[playerNumber].isRCBombActive = true; f_RCBombTimer[playerNumber] = 10; print("RCBomb"); break; case PickupTypes.SpeedBoost: e_playerPickups[playerNumber].playerSpeed++; playerGo[playerNumber].GetComponent <PlayerController>().moveSpeed += 1; print("SpeedBoost"); break; default: break; } }
public virtual void ApplyPickup(PickupTypes thisItemType, float itemValue) { print("Item Picked up: " + itemValue + thisItemType.ToString()); if (Pcon) { Pcon.ApplyPickuptoPlayerCon(thisItemType, itemValue); } if (destroyOnPickup) { if (useAudio) { PickUpAudioSource.Play(); Destroy(gameObject, pickUpSound.length); } else { Destroy(gameObject); } } if (respawnItemAfterPickup) { if (useAudio) { PickUpAudioSource.Play(); } StartCoroutine("delayRespawnItem"); } }
// spawns a item in front of player GameObject SpawnItemByType(PickupTypes itemType, Transform targetPos, bool addToManager = true, Transform parent = null) { GameObject itemToSpawn = ItemsManager.instance.GetItemByType(itemType); // spawn location //Transform orientation = transform.GetChild(0); Vector3 pos = targetPos.position + (targetPos.forward * itemSpawnOffset.z); pos.y += itemSpawnOffset.y; GameObject item; if (parent) { item = Instantiate(itemToSpawn, parent); item.transform.localPosition = Vector3.zero; if (!addToManager) { item.layer = LayerMask.NameToLayer("Default"); Destroy(item.GetComponent <Rigidbody>()); Destroy(item.GetComponent <Collider>()); } } else { item = Instantiate(itemToSpawn, pos, UnityEngine.Random.rotation); } // re-add lost item reference to the items manager if (addToManager) { ItemsManager.instance.ReAddItem(item); } return(item); }
IEnumerator SpawnPickupAfterSomeDelay(Vector3 pos) { yield return(new WaitForSeconds(0.2f)); e_pickup = (PickupTypes)Random.Range(0, System.Enum.GetNames(typeof(PickupTypes)).Length); GameObject pickupGO = null; switch (e_pickup) { case PickupTypes.LongBlast: pickupGO = Instantiate(longBlastPrefab, pos, Quaternion.identity); pickupGO.name = "LongBlast"; break; case PickupTypes.MoreBombs: pickupGO = Instantiate(moreBombsPrefab, pos, Quaternion.identity); pickupGO.name = "MoreBombs"; break; case PickupTypes.RCBomb: pickupGO = Instantiate(rCBombPrefab, pos, Quaternion.identity); pickupGO.name = "RCBomb"; break; case PickupTypes.SpeedBoost: pickupGO = Instantiate(speedBoostPrefab, pos, Quaternion.identity); pickupGO.name = "SpeedBoost"; break; } }
public IPickup Create(PickupModels modelhash, PickupTypes type, uint value, CVector3 vecPosition, CVector3 vecRotation) { ushort id = Imports.Pickups.Pickups_Create((uint)modelhash, (byte)type, value, vecPosition, vecRotation); return new Pickup() { PickupId = id }; }
public void RifleDefinition() { weaponType = WeaponTypes.auto; damage = 10; range = 500; projectileSpeed = 15; originCooldown = 200; pickUpType = PickupTypes.rifle; }
public void GunDefinition() { weaponType = WeaponTypes.semiAuto; damage = 5; range = 400; projectileSpeed = 15; originCooldown = 100; pickUpType = PickupTypes.handgun; }
public void NewPickup(Vector3 position) { if (Random.Range(0, 100) <= DropChance) { //Ve se o Inimigo dropou um Item de acordo com a Chance de Drop. PickupTypes type = RandomPickupType(); Debug.Log("pickup: " + type.ToString()); spawnedPickups.Add(Instantiate(Pickups.Find(p => p.type == type).gameObject, position, Quaternion.identity)); } }
public Pickup(Vector2 position, PickupTypes type) : base() { Position = position; pickupType = type; isInteractable = false; TexWidth = 32; TexHeight = 32; pickupCenter = new Vector2(position.X + TexWidth / 2, position.Y + TexHeight / 2); base.Update(); }
public void NewPickup(Vector3 position) { if (Random.Range(0, 100) <= DropChance) { //see if enemy drops an item according to DropChance PickupTypes type = RandomPickupType(); Debug.Log("pickup: " + type.ToString()); spawnedPickups.Add(Instantiate(Pickups.Find(p => p.type == type).gameObject, position, Quaternion.identity)); } }
public PickupObjectPropertiesViewModel( TreeViewViewModel treeParent, CompoundObjectViewModel parentVm, MainViewModel mainVm, PickupObjectProperties modelObject, bool enabled = true) : base(treeParent, parentVm, mainVm, enabled) { ModelObject = modelObject; SelectedPickupTypeIndex = PickupTypes.IndexOf(LocalModelObject.PickupType); SelectedAmountTypeIndex = AmountTypes.IndexOf(LocalModelObject.PickupAmountType); }
public void ShowPickupText(GameObject pickup, PickupTypes type, Vector3 position, string text) { if (type == PickupTypes.sentry) { activeSentryPickups--; } spawnedPickups.Remove(pickup); Destroy(pickup); GameObject newPickupText = Instantiate(PickupTextPrefab, position, Quaternion.Euler(new Vector3(90, 0, 0))); newPickupText.GetComponent <TextMesh> ().text = text; spawnedTexts.Add(newPickupText); StartCoroutine(PickupTextTimer()); }
public GameObject GetItemByType(PickupTypes itemType) { switch (itemType) { case PickupTypes.ToiletPaper: return(GetRandomArrayEl(toiletPapers)); case PickupTypes.Sanitizer: return(GetRandomArrayEl(sanitizers)); case PickupTypes.Chips: return(GetRandomArrayEl(chips)); } return(null); }
void tickDownStat(PickupTypes statType) { switch (statType) { case PickupTypes.notoriety: //We want to operate on our variables in here currentNotoriety -= Time.deltaTime; // print("Notorious as: " + currentNotoriety); break; case PickupTypes.popularity: //We want to operate on our variables in here currentPopularity -= (Time.deltaTime * statDepletionRate); //print("Popular as: " + currentPopularity); break; } }
// add to inventory public bool Add(PickupTypes pickupType) { // add item to specified slot if inventory isn't full if (GetInventorySize() < maxInventorySize) { items[(int)pickupType]++; Debug.Log("1 item added to: " + pickupType); // Fire onInventoryChange event if (onInventoryChange != null) { onInventoryChange(); } PrintInventory(); return(true); } return(false); }
private void Start() { if (myGeometry == null) { myGeometry = transform.GetChild(0); } id = (int)myType; if (id == 42) { id = Random.Range(0, maxTypes + 1); myType = (PickupTypes)id; } MeshFilter myFilter = myGeometry.GetComponent <MeshFilter>(); myFilter.sharedMesh = myPickupSettings[id].mesh; Renderer myRenderer = myGeometry.GetComponent <Renderer>(); myRenderer.material.mainTexture = myPickupSettings[id].texture; }
private void SpawnPickable(Vector3 position, PickupTypes pickupType, PickupSpawnerController spawner) { switch (pickupType) { case PickupTypes.Medkit: var medkit = Instantiate(pickupPrefabMedkit, position, Quaternion.identity); medkit.gameObject.GetComponentInChildren <MedkitController>().SetAssociatedSpawner(spawner); break; case PickupTypes.Shotgun: var weaponShotgun = Instantiate(pickupPrefabShotgun, position, Quaternion.identity); weaponShotgun.gameObject.GetComponentInChildren <WeaponController>().SetAssociatedSpawner(spawner); break; case PickupTypes.Uzi: var weaponUzi = Instantiate(pickupPrefabUzi, position, Quaternion.identity); weaponUzi.gameObject.GetComponentInChildren <WeaponController>().SetAssociatedSpawner(spawner); break; } }
public bool Remove(PickupTypes pickupType, int count = 1, bool addToManager = true) { // remove count from specified slot if it's more than 0 if (items[(int)pickupType] >= count) { items[(int)pickupType] -= count; Debug.Log(count + " items removed from: " + pickupType); // spawn the dropped items in front of player Transform orientation = transform.GetChild(0); for (int i = 0; i < count; i++) { SpawnItemByType(pickupType, orientation, addToManager); } // Fire onInventoryChange event if (onInventoryChange != null) { onInventoryChange(); } PrintInventory(); return(true); } return(false); }
public WeaponPickup(Vector2 position, PickupTypes type) : base(position, type) { pickupType = type; radius = 60; }
//Player Pickups #region Player Pickups public void ApplyPickuptoPlayerCon(PickupTypes type, float value) { print("player recieved pickup: " + type.ToString()); switch (type) { case PickupTypes.health: currentHealth = Mathf.Clamp((currentHealth + value), 0, maxHealth); PlayerHudManager.instance.UpdateStatsPanel(); if (playerDH) { playerDH.ApplyHealth(value, true); } break; case PickupTypes.keyPickup: currentKeys = (currentKeys + value); PlayerHudManager.instance.UpdateStatsPanel(); break; case PickupTypes.xp: print("XP FIRED"); if (currentXp + value >= xpToNextLevel) { PlayerLevelup(); } currentXp += value; break; case PickupTypes.money: currentMoney += value; break; case PickupTypes.ammo: currentAmmo += value; break; case PickupTypes.popularity: currentPopularity += value; break; case PickupTypes.notoriety: currentNotoriety += value; break; case PickupTypes.points: currentPoints += value; break; case PickupTypes.armour: currentArmour += value; break; case PickupTypes.food: currentFood += value; if (currentFood > maxFood) { currentFood = maxFood; } break; } }
// returns the count of a specific item public int GetItemCount(PickupTypes itemType) { return(items[(int)itemType]); }
public ResourcePickup(Vector2 position, PickupTypes type) : base(position, type) { healthPickUpAmount = 2; radius = 20; }
// Constructor public Pickup(float _x, float _y, float _z, PickupTypes _type, string _name) : base(_x, _y, _z, _name) { type = _type; }
// Default Constructor public Pickup() : base() { type = PickupTypes.Health; }