internal CollectableType NextTailPartsPop() { CollectableType nextTail = _nextTailParts.Last(); _nextTailParts.Remove(nextTail); return(nextTail); }
public void ToolTP() { if (toolType == ToolType.Machado) { Debug.Log("É um Machado"); collectableType = CollectableType.Madeira; Debug.Log(collectableType); } else if (toolType == ToolType.Foice) { Debug.Log("É uma Foice"); collectableType = CollectableType.Grama; Debug.Log(collectableType); } else if (toolType == ToolType.Picartea) { Debug.Log("É uma Picareta"); collectableType = CollectableType.Pedra; Debug.Log(collectableType); } else if (toolType == ToolType.Enxada) { Debug.Log("É uma Enxada"); collectableType = CollectableType.Terreno; Debug.Log(collectableType); } }
public void placeStopDown() { if (Items[0].GetComponent <Collectable>().CollectableType == CollectableType.Stops) { TaskObject.GetComponent <Construction_Script>().Contained_Stops++; System_Script.CollectableStops.Remove(Items[0]); var index = TaskObject.GetComponent <Construction_Script>().Workerlist_Stops.IndexOf(this.gameObject); Items[0].transform.rotation = TaskObject.GetComponent <Construction_Script>().RequiredStopsListPoints[index].transform.rotation; Items[0].transform.eulerAngles += new Vector3(0, 180, 0); Items[0].transform.position = new Vector3(Items[0].transform.position.x, 0.1f, Items[0].transform.position.z); TaskObject.GetComponent <Construction_Script>().RequiredStopsListPoints.RemoveAt(index); TaskObject.GetComponent <Construction_Script>().aquiredObj.Add(Items[0]); Items[0].GetComponent <Collectable>().MakeStatic(); Items[0].GetComponent <Animation>().Play("Open"); } Items.Clear(); CurrentTask = CurrentJob.Nothing; TaskChassis = TaskChassis.Nothing; ItemType = CollectableType.Nothing; }
public Collectable GetRandom(CollectableType type) { if (!RuntimeCollectableGroups.ContainsKey(type)) { return(null); } CollectableGroup group = RuntimeCollectableGroups[type]; CollectableSpawnProbability[] possibleCollectables = group.PossibleCollectables; Collectable result = null; uint randomBucket = (uint)Random.Range(0, group.TotalFrequency); uint curBucketMin = 0; for (int i = 0, end = possibleCollectables.Length; i < end; i++) { if (curBucketMin <= randomBucket && randomBucket < curBucketMin + possibleCollectables[i].Frequency) { result = possibleCollectables[i].CollectablePrefab; } curBucketMin += possibleCollectables[i].Frequency; } return(result); }
// add a transformation to spawn manager, retrieve the id where the spawn location was inserted // call before everything public int RegisterSpawnItemLocation(Transform mySpawnLocation, CollectableType myItemType, bool needSpawn = false, bool forceSpawn = false, Shapes shapes = Shapes.None, int nbItems = 1, float circleRadius = 1.0f) { dicSpawnItemsLocations.Add(lastInsertedKeySpawnItems, mySpawnLocation); if (needSpawn) { switch (shapes) { case Shapes.None: SpawnItem(lastInsertedKeySpawnItems, myItemType, forceSpawn); break; case Shapes.Circle: SpawnCircleShapedItems(lastInsertedKeySpawnItems, nbItems, myItemType, forceSpawn, circleRadius); break; case Shapes.Line: SpawnLineShapedItems(lastInsertedKeySpawnItems, nbItems, myItemType, forceSpawn); break; case Shapes.Grid: SpawnGridShapedItems(lastInsertedKeySpawnItems, nbItems, myItemType, forceSpawn); break; } } return(lastInsertedKeySpawnItems++); }
private void LocalPlayer_InventoryChange(Operation op, CollectableType key, int newAmount) { this.Delayed(0, () => // Need to delay to make sure the changes have been applied. { resourceText.text = localPlayer.GetInventoryCount(CollectableType.TowerResource).ToString(); UpdatePowerupButton(CollectableType.PowerupFreeze, freezeButton, freezeAmountText); UpdatePowerupButton(CollectableType.PowerupJamTowers, jamButton, jamAmountText); UpdatePowerupButton(CollectableType.PowerupGrapplingHook, grappleButton, grappleAmountText); }); if (op == Operation.OP_SET) { int oldAmount = localPlayer.GetInventoryCount(key); Debug.Log(key + " from " + oldAmount + " to " + newAmount); Transform target; switch (key) { case CollectableType.PowerupFreeze: target = freezeAmountText.transform; break; case CollectableType.PowerupJamTowers: target = jamAmountText.transform; break; case CollectableType.TowerResource: target = resourceText.transform; break; default: return; } this.AnimateVector(0.3f, Vector3.one, valueUpdatePopSize * Vector3.one, valueUpdatePopCurve, v => target.localScale = v); } }
private void UpdatePowerupButton(CollectableType type, Button button, TMPro.TextMeshProUGUI amountText) { int amount = localPlayer.GetInventoryCount(type); amountText.text = amount.ToString(); button.interactable = amount > 0; }
private void Start() { this.maxCount = GameProgress.MaxSkullCount(); this.m_skull = base.transform.Find("Skull"); this.m_skull.localPosition = -Vector3.up * 17f; this.m_bgColor = base.transform.Find("BackgroundBox").GetComponent <Renderer>().material; int num = 0; CollectableType collectableType = this.type; if (collectableType != CollectableType.Skull) { if (collectableType == CollectableType.Statue) { num = GameProgress.SecretStatueCount(); } } else { num = GameProgress.SecretSkullCount(); } base.transform.Find("Skull/SkullText").GetComponent <TextMesh>().text = ((num >= 10) ? (num + "/" + this.maxCount) : string.Concat(new object[] { "0", num, "/", this.maxCount })); base.StartCoroutine(this.PlayAnimation()); }
public Collectable(string _CollectableID, CollectableType _CollectableType, bool _CollectableCollected) { CollectableID = _CollectableID; CollectableType = _CollectableType; CollectableCollected = _CollectableCollected; GFXParent = null; }
internal void AddCollectable(CollectableType value) { Collectables[value]++; string message = "You collected a " + CollectableNames[(int)value] + " powerup!"; SetEventText(message, TimeSpan.FromSeconds(5)); }
public ICollectable build(CollectableType type, Vector2 location) { factory = new SpriteFactory(); if (type == CollectableType.coin) { product = new Coin(location); } if (type == CollectableType.star) { product = new Star(location); } if (type == CollectableType.oneUp) { product = new OneUpMushroom(location); } if (type == CollectableType.fireFlower) { product = new FireFlower(location); } if (type == CollectableType.superMushroom) { product = new SuperMushroom(location); } if (type == CollectableType.ninja) { product = new Ninja(location); } return(product); }
void OnTriggerEnter2D(Collider2D other) { if (other.tag.Equals(Tags.ENEMY)) { mAudioSource.Stop(); mAudioSource.Play(); isStunned = true; StartCoroutine(resetStun()); return; } ICollectable collectable = other.GetComponent <ICollectable>(); // we only care if we collid with an collectable if (collectable != null) { CollectableType type = collectable.Collect(); if (type == CollectableType.NONE) { return; } if (type == CollectableType.HP_BOBBLE) { mHealthManager.GainHealth(HP_GAIN_VALUE); HighscoreManager.Instance.AddToScore(HighscoreManager.GET_HEALTH); return; } mInventory.AddInventoryItem(type); HighscoreManager.Instance.AddToScore(HighscoreManager.FIND_CORE); } }
public void Feed(Entity collector, CollectableType collectedType) { _snakeEater._nextTailParts.Add(collectedType); SnakeBlock collectorSnakeBlock = (SnakeBlock)collector; collectorSnakeBlock.HasFood = true; }
public static bool CheckEvolutionAndCollectableTypeCompatibility(CollectableType _collectableType, EvolutionComponent _currentComponent) { return((_collectableType == CollectableType.AgileEvolution1 && _currentComponent is EvolutionAgile) || (_collectableType == CollectableType.PlatformistEvolution1 && _currentComponent is EvolutionPlatformist) || (_collectableType == CollectableType.GhostEvolution1 && _currentComponent is EvolutionGhost) || (_collectableType == CollectableType.StrengthEvolution1 && _currentComponent is EvolutionStrength)); }
/* * Returns true if collectableType is linked to an evolution */ public static bool IsAnEvolutionCollectable(CollectableType collectableType) { return(collectableType == CollectableType.StrengthEvolution1 || collectableType == CollectableType.PlatformistEvolution1 || collectableType == CollectableType.AgileEvolution1 || collectableType == CollectableType.GhostEvolution1); }
public static Collectable newRandomCollectable() { float rand = Random.value; CollectableType type = CollectableType.Empty; if (rand < 0.4f) { type = CollectableType.SpeedUp; } else if (rand < 0.8f) { type = CollectableType.Weapon; } else { type = CollectableType.Enlarge; } WeaponType weapon = WeaponType.None; if (type == CollectableType.Weapon) { //TODO add new types of weapons weapon = WeaponType.Projectile; } return(new Collectable(type, weapon)); }
public Collectable GetCollectable(CollectableType _type) { Collectable collectable = null; switch (_type) { case CollectableType.Gold: collectable = goldCoins.GetPooledCollectable(); break; case CollectableType.Stamina: collectable = staminaBars.GetPooledCollectable(); break; case CollectableType.Charge: collectable = charges.GetPooledCollectable(); break; case CollectableType.Shield: collectable = shields.GetPooledCollectable(); break; case CollectableType.MegaCoin: collectable = megaCoins.GetPooledCollectable(); break; default: Debug.LogError("Invalid Request to Collectable Pooler"); break; } return(collectable); }
private void SpawnGridShapedItems(int idLocation, int nbItems, CollectableType myItemType, bool forceSpawn = false) { if (dicSpawnItemsLocations.ContainsKey(idLocation) == false) { Debug.Log("Error : invalid location"); return; } if (!forceSpawn && SpawnedItemsCount == MAXSPAWNITEMSCOUNTATTHESAMETIME) { Debug.Log("Error : max item reach"); return; } // TMP heuristic int ligne = Mathf.RoundToInt(Mathf.Sqrt(nbItems)); int colonne = Mathf.FloorToInt(nbItems / ligne); for (int i = 0; i < colonne; i++) { for (int j = 0; j < ligne; j++) { SpawnedItemsCount++; ResourceUtils.Instance.refPrefabLoot.SpawnCollectableInstance( GetVector3ArrayOnAGrid(dicSpawnItemsLocations[idLocation].transform.position, dicSpawnItemsLocations[idLocation].transform.forward, ligne, colonne)[i, j], dicSpawnItemsLocations[idLocation].transform.rotation, dicSpawnItemsLocations[idLocation].transform, myItemType ).GetComponent <Collectable>().Init(); } } }
public Collectable(Vector2 currentPosition, Vector2 velocity, World world, CollectableType t) : base(currentPosition, velocity, world) { isPickedUp = false; size = new Vector2(16, 16); hitBox = new Rectangle((int)currentPosition.X, (int)currentPosition.Y, (int)size.X, (int)size.Y); this.type = t; }
public Evolution(Powers _powerName, float _duration, CollectableType _associatedCollectable, int _cost, BodyPart _bodyPart) { id = (int)_powerName; duration = _duration; associatedCollectable = _associatedCollectable; cost = _cost; bodyPart = _bodyPart; }
public void SetValues(CollectableType collectableType, Vector3 position, Material material) { var meshRenderer = GetComponent <MeshRenderer>(); CollectableType = collectableType; transform.position = position; meshRenderer.material = material; }
public void PickUpCollectable() { CurrentTask = CurrentJob.CarringCollectable; TaskObject.GetComponent <Collectable>().CollectedCart = CollectionSpace; Items.Add(TaskObject); ItemType = TaskObject.GetComponent <Collectable>().CollectableType; FindNearestCollectableDropOff(); }
public void AddInventoryItem(CollectableType type) { if (type == CollectableType.NONE) { return; } AddInventoryItem(CollectableFactory.Instance.CreateCollectable(type)); }
public bool Contains(CollectableType itemType) { if (items.TryGetValue(itemType, out uint count)) { return(count > 0); } return(false); }
private void HandleCollection(CollectableType _collectableType, ushort _score, int _ID) { if (collectableList.Count <= 0) { return; } collectableList[_ID].gameObject.SetActive(false); }
public int NumberOfCollectables(CollectableType _CollectableType, bool _countAllCollectables = false) { if (_countAllCollectables == true) { return(LoadSaveController.LoadedCollectables.Count); } return(LoadSaveController.LoadedCollectables.Where(a => a.CollectableType == _CollectableType).Count()); }
/// <summary>Returns how many items of the given type the player has in their inventory.</summary> public int GetInventoryCount(CollectableType type) { if (type == CollectableType.None) { throw new ArgumentException("cannot lookup invalid type"); } inventory.TryGetValue(type, out int value); return(value); }
public void AddToInventory(CollectableType type, int amount) { if (type == CollectableType.None) { throw new ArgumentException("cannot add invalid type"); } inventory.TryGetValue(type, out int value); inventory[type] = value + amount; }
public void AddScore(CollectableType ct) { int intCt = (int)ct; Assert.IsTrue(intCt < collectableValues.Length); score += collectableValues[intCt]; SetScoreText(); playerProgress.SetHiScore(score); //Debug.Log("score: " + score); }
public void RemoveItem(CollectableType itemType) { if (!items.ContainsKey(itemType) || items[itemType] == 0) { Debug.LogError("Trying to remove an item not contained in the inventory."); return; } items[itemType] -= 1; }
public void placeItem(GameObject item, CollectableType type) { // based on the type of collectable (Collectable.TYPE) // put in the correct place if (type == CollectableType.HAND) { item.transform.parent = handCollectable; } else { item.transform.parent = headCollectable; } // make sure the local position and rotation of the item is reset // so that it's location on the character is defined by the // orientation of the transform item.transform.localPosition = Vector3.zero; item.transform.localRotation = Quaternion.identity; // Add a Direct Connection to the item collected // - the player will trust items that they pick up that they can // carry in hand, but distrust items that have to be carried overhead (for safety) if (type == CollectableType.HAND) { // player HAS this other actor (which is an item) _graph.AddDirectConnection(new Connection(gameObject, item, RelationshipType.HAS)); // make the player dangerous after picking up a weapon _player.actorType = ActorType.DANGEROUS; } else { // player HAS this other actor (which is an item) _graph.AddDirectConnection(new Connection(gameObject, item, RelationshipType.HAS)); // animals make us all nicer people _player.actorType = ActorType.ANIMAL; } // increase the number of items collected _gc.Items++; }