void OnTriggerEnter2D(Collider2D col) { if (col.CompareTag(Tags.COLLECTIBLE) && current == null && (col.transform.parent == null || ! col.transform.parent.CompareTag(Tags.DESTINATION))) { current = col.transform.GetComponent<Collectible>(); current.transform.SetParent(slot); current.transform.DOLocalMove(Vector3.zero, tweenTime); current.transform.DOLocalRotateQuaternion(Quaternion.identity, tweenTime); current.Destination.GetComponent<Animator>().SetBool("Blinking", true); musicPlayer.StartPlaying(current.Type); } Destination dest = col.GetComponent<Destination>(); if (dest != null && current != null && dest.Type == current.Type) { Destroy(dest.GetComponent<Animator>()); dest.Hide(); current.transform.parent = col.transform; current.transform.DOLocalMove(Vector3.zero, tweenTime); current.transform.DOLocalRotateQuaternion(Quaternion.identity, tweenTime); current.DisableTrigger(); current = null; } }
public void AddCollectible(Collectible collectible) { if (collectibleList == null) { collectibleList = new List<Collectible>(); } collectibleList.Add(collectible); }
void Awake() { t_transformSpawn = new List<Transform>(); CollectibleComponent = m_collectible.GetComponent<Collectible>(); m_currentSpawn = null; m_scoreComponent = m_hudPlayer.GetComponent<Score>(); m_timerComponent = m_hudPlayer.GetComponent<Timer>(); }
private void Awake() { collectible = GetComponentInChildren<Collectible>(); if (collectible != null) collectible.OnCollect += OnCollect; lifeCooldown = MinLifeTime; }
public void DropCollectible() { if (!collectible) { return; } collectible.Release(); collectible = null; }
public override void OnDeath() { foreach (Collectible item in drops) { Collectible newItem = GameObject.Instantiate(item, transform.position, Quaternion.identity); newItem.GetComponent <Rigidbody2D>().velocity = Vector2.up * 4f; } lootedChests.Add(id); base.OnDeath(); }
public void UpgradeSupply(Collectible collectible) { soundController.PlayIncreaseOxygen(); var rectTransform = slider.GetComponent <RectTransform>(); rectTransform.sizeDelta = new Vector2(rectTransform.rect.width + collectible.value, rectTransform.rect.height); maxSupply += collectible.value; supply = maxSupply; StartCoroutine(FillSupplyBar(true)); }
public void MergeFrom(Chance other) { if (other == null) { return; } if (other.display_ != null) { if (display_ == null) { Display = new global::Monopoly.Protobuf.ChanceDisplay(); } Display.MergeFrom(other.Display); } switch (other.ExtraCase) { case ExtraOneofCase.Unspecified: Unspecified = other.Unspecified; break; case ExtraOneofCase.MoveToTile: if (MoveToTile == null) { MoveToTile = new global::Monopoly.Protobuf.MoveToTileExtra(); } MoveToTile.MergeFrom(other.MoveToTile); break; case ExtraOneofCase.MoneyExchange: if (MoneyExchange == null) { MoneyExchange = new global::Monopoly.Protobuf.MoneyExchangeExtra(); } MoneyExchange.MergeFrom(other.MoneyExchange); break; case ExtraOneofCase.MoveSteps: if (MoveSteps == null) { MoveSteps = new global::Monopoly.Protobuf.MoveStepsExtra(); } MoveSteps.MergeFrom(other.MoveSteps); break; case ExtraOneofCase.Collectible: if (Collectible == null) { Collectible = new global::Monopoly.Protobuf.CollectibleExtra(); } Collectible.MergeFrom(other.Collectible); break; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); }
private string GetAvailableCollectiblesStateId() { float agentPosition = xPos; Collectible c = GetClosestCollectible(); float closestCollectiblePosition = c.xPos; string s = ""; int leftPos = (int)(agentPosition - AgentPlatform.Left) / CircleWorldModel.DEFAULT_RADIUS; int rightPos = (int)(AgentPlatform.Right - agentPosition) / CircleWorldModel.DEFAULT_RADIUS; s += "/-Pos:" + leftPos; s += "/+Pos:" + rightPos; int speed = ((int)xSpeed / 20); s += "/Speed:" + speed.ToString(); int numberCollectibles = AgentPlatform.Collectibles.Count; s += "/Colls:" + numberCollectibles; int colXVector = (int)((c.xPos - xPos) / (CircleWorldModel.DEFAULT_RADIUS)); int colYVector = (int)((c.yPos - yPos) / (CircleWorldModel.DEFAULT_RADIUS)); s += "/ColVector:[" + colXVector + "/" + colYVector + "]"; if (colXVector >= 1) { if (closestCollectiblePosition > AgentPlatform.Right - 5 * CircleWorldModel.DEFAULT_RADIUS) { if (AgentPlatform.RightWall) { s += "/End:-Wall"; } } } else { if (closestCollectiblePosition < AgentPlatform.Left + 5 * CircleWorldModel.DEFAULT_RADIUS) { if (AgentPlatform.LeftWall) { s += "/+Wall"; } } } return(s); }
private static EntityDataRoot smethod_13(Map map_0, Collectible collectible_0) { EntityDataRoot entityDataRoot = GClass840.smethod_2(map_0, collectible_0); Color color_ = MapUtils.smethod_16(map_0, collectible_0); entityDataRoot.Data = new List <EntityRenderFragment> { GClass840.smethod_6(color_, 3, null) }; return(entityDataRoot); }
internal override bool isOnPlatform(Platform p, Collectible c) { if (c.yPos > p.Top - 2 * DEFAULT_HEIGHT - WorldModel.COLLECTIBLE_HEIGHT) { return(c.xPos >= p.Left - DEFAULT_HEIGHT / 2 && c.xPos <= p.Right + DEFAULT_HEIGHT / 2); } else { return(false); } }
public BarSpudPane(BarSpud bars, Collectible symbol, BarSpudGraph parent, DispatcherObject dispatchTo) : base(parent, dates(bars)) { this.bars = bars; this.symbol = symbol; parentTyped = parent; this.dispatchTo = dispatchTo; XAxis.Scale.Min = Math.Max(0, bars.count() - 100); XAxis.Scale.Max = bars.count() + 5; XAxis.Scale.IsVisible = false; }
void ClearLevel() { for (int i = 0; i < collectibleList.Count; ++i) { Collectible collectible = collectibleList[i]; if (collectible.isHitted == false) { collectible.Splash(); } } }
void letGo() { if (thingIGrabbed) { Collider[] overlappingThingsWithLeftHand = Physics.OverlapSphere(leftPointerObject.transform.position, 0.01f, collectiblesMask); detachGameObject(thingIGrabbed.gameObject, AttachmentRule.KeepWorld, AttachmentRule.KeepWorld, AttachmentRule.KeepWorld); simulatePhysics(thingIGrabbed.gameObject, Vector3.zero / Time.deltaTime, true); thingIGrabbed = null; } }
/// <summary> /// Gets any collectible parquet at the position. /// </summary> /// <param name="in_position">The position whose collectible is sought.</param> /// <returns>The collectible at the given position, or <c>null</c> if there is none.</returns> public Collectible GetCollectibleAtPosition(Vector2Int in_position) { Collectible result = null; if (IsValidPosition(in_position)) { result = AllParquets.Get <Collectible>(_collectibleLayer[in_position.X, in_position.Y]); } return(result); }
public void InvalidFloorIDsRaiseExceptionTest() { var badFloorID = TestEntities.TestBlock.ID; void TestCode() { var _ = new Collectible(badFloorID, "will fail", "", ""); } Assert.Throws <ArgumentOutOfRangeException>(TestCode); }
public override void OnHitCollectible(Collectible collectible) { base.OnHitCollectible(collectible); if (!canGatherCollectibles) { return; } ReturnToThrower(); }
public static EntityState[] AccessHolders(CollectibleInstances collectibleName) { Collectible thisEvent = null; EntityState[] holders = null; if (collectibleDictionary.TryGetValue(collectibleName, out thisEvent)) { holders = thisEvent.Holders(); } return(holders); }
void Spawn() { if (collectibleSpawned != null) { Debug.Log("Destroying old spawned collectible"); Destroy(collectibleSpawned.gameObject); } Debug.Log(this.gameObject.name + " is spawning " + GameManager.instance.collectibles[0].collectibleName); collectibleSpawned = Instantiate(GameManager.instance.collectibles[0], this.transform.position, Quaternion.identity, this.transform); }
public static bool StateIsHolder(EntityState state, CollectibleInstances collectibleName) { Collectible thisEvent = null; bool val = false; if (collectibleDictionary.TryGetValue(collectibleName, out thisEvent)) { val = thisEvent.HolderTest(state); } return(val); }
public override void Interact(Person who) { Debug.Log("Door Interact!!"); Collectible selected = who.SelectedItem(); if (!_animator.GetBool("Open") && selected != null && selected.name == "Main Key") { _animator.SetBool("Open", true); who.Drop(); } }
private void RemoveItem(Collectible item) { if (!items.Contains(item)) { return; } items.Remove(item); UnMountItem(item); SendItemRemovedEvent(item); }
public void Drop() { if (this.collectible == null) { return; } this.collectible.Unstick(); this.rigidbody.AddExplosionForce(10, this.transform.position, 1f); this.collectible = null; }
public void ShouldSortEmpty() { Reflector reflector = new Reflector(); Serializer <Item> serializer = reflector.GetSerializer <Item>();; Collectible collectible = new Collectible(1024); SortPredicate <Item> predicate = new SortPredicate <Item>(serializer, x => x.Value); Sort.Table(collectible, predicate); Assert.That(collectible.Count, Is.Zero); }
/*void ShowTheGoods(bool doShow = true) * { * bool displayMessage = doShow; * * if (Type == GrottoType.UniqueItem) * { * ShowTheUniqueItem(doShow); * } * if (Type == GrottoType.Shop) * { * ShowTheShopItems(doShow); * if (IsSoldOut) { displayMessage = false; } * } * if (Type == GrottoType.Medicine) * { * ShowTheShopItems(doShow); * if (IsSoldOut) { displayMessage = false; } * } * if (Type == GrottoType.Gift) * { * ShowGift(doShow); * } * if (Type == GrottoType.PayRupees) * { * ShowRupeeDeduction(doShow); * } * if (Type == GrottoType.Gamble) * { * ShowGambleChoices(doShow); * } * if (Type == GrottoType.HeartContainer) * { * ShowTheShopItems(doShow, false); * if (IsSoldOut) { displayMessage = false; } * } * if (Type == GrottoType.PayForInfo) * { * ShowPayForInfoChoices(doShow); * } * * if (displayMessage) * { * DisplayMessage(); * } * }*/ public Collectible InstantiateItem(GameObject prefab, Transform container, int price = 0) { Collectible c = (Instantiate(prefab) as GameObject).GetComponent <Collectible>(); c.Grotto = this; c.price = price; c.transform.SetParent(container); c.transform.localPosition = Vector3.zero; return(c); }
public void ReturnCollectible() { if (current == null) { return; } current.Destination.GetComponent<Animator>().SetBool("Blinking", false); current.ReturnToOrigin(); musicPlayer.StopPlaying(current.Type); current = null; }
public void OnItemCollected(Collectible collectible, int amount = 1) { string itemName = collectible.itemPrefab.name; OnItemCollected(itemName, amount); if (itemName == "TriforcePiece") { collectible.GetComponent <Triforce>().Fanfare(); } }
void Update() { if (Input.GetMouseButtonDown(1)) { Ray ray = Cam.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, RayRange, EnemyLayer)) { Character enemy = hit.collider.GetComponent <Character>(); if (enemy != null) { PickupTarget = null; EnemyTarget = enemy; } } else if (Physics.Raycast(ray, out hit, RayRange, PickupLayer)) { Collectible obj = hit.collider.GetComponent <Collectible>(); if (obj != null) { EnemyTarget = null; PickupTarget = obj; } } else if (Physics.Raycast(ray, out hit, RayRange, WalkableLayer)) { EnemyTarget = null; PickupTarget = null; locomotionController.MoveToPoint(hit.point); } } if (EnemyTarget != null) { locomotionController.MoveToCharacter(EnemyTarget); locomotionController.FaceObjectFrame(EnemyTarget.transform); float distance = Vector3.Distance(EnemyTarget.transform.position, transform.position); if (distance <= EnemyTarget.ContactRadius) { combatController.MeleeAttack(EnemyTarget); } } else if (PickupTarget != null) { locomotionController.MoveToCollectible(PickupTarget); float distance = Vector3.Distance(PickupTarget.transform.position, transform.position); if (distance <= PickupTarget.ContactRadius) { PickupTarget.Pickup(); PickupTarget = null; } } }
public static int GetHeapCount(EntityState state, CollectibleInstances collectibleName) { Collectible thisEvent = null; int val = 0; if (collectibleDictionary.TryGetValue(collectibleName, out thisEvent)) { val = thisEvent.HeapCount(state); } return(val); }
// Update is called once per frame void Update() { timer += Time.deltaTime; if (timer >= 30) { Collectible c = Instantiate(collectible, new Vector3(CollectibleSpawnPoint.position.x, CollectibleSpawnPoint.position.y, CollectibleSpawnPoint.position.z), CollectibleSpawnPoint.rotation) as Collectible; timer = 0; Destroy(c, 31); } }
public void RemovedFromCollection(Collectible collectibleObj) { for (var index = collectablesList.Count - 1; index >= 0; index--) { var obj = collectablesList[index]; if (obj == collectibleObj) { collectablesList.Remove(collectibleObj); } } }
//Collect items and store them foreach independant rituals public void CollectItem(CollectibleType ct, Collectible c) { if (_ritualCollectibles.ContainsKey(ct)) { _ritualCollectibles[ct].Add(c); } else { _ritualCollectibles.Add(ct, new List<Collectible> { c }); } }
internal void RemoveCollectibleAnnotation(Collectible collectible) { ARAnnotationItem item; if (m_collectibleItems.TryGetValue(collectible.Id, out item)) { m_collectibleItems.Remove(collectible.Id); CollectibleTable.RemoveItem(item); } }
public void OpenDoor(Collectible obj) { if (list.collectablesList.Contains(obj)) { canOpen = true; } else { textCanvas.SetActive(true); } }
public void InvalidItemIDsRaiseExceptionTest() { var badItemID = TestParquets.TestBlock.ID; void TestCode() { var _ = new Collectible(newCollectibleID, "will fail", in_itemID: badItemID); } Assert.Throws <ArgumentOutOfRangeException>(TestCode); }
public void AddNewItem(Collectible item) { if (_collection == null) _collection = new Dictionary<Collectible, Icon> (); GameObject newObject = Instantiate(IconPrefab, new Vector3(0, 0, 0), Quaternion.identity) as GameObject; newObject.transform.SetParent(UIListContainer.transform, false); newObject.GetComponent<Icon>().Inventory = this; newObject.GetComponent<Icon>().Collectible = item; _collection.Add (item.GetComponent<Collectible>(), newObject.GetComponent<Icon>()); }
/// <summary> /// Returns true if both stacks exactly match /// </summary> /// <param name="worldForResolve"></param> /// <param name="sourceStack"></param> /// <param name="ignoreAttributeSubTrees"></param> /// <returns></returns> public bool Equals(IWorldAccessor worldForResolve, ItemStack sourceStack, params string[] ignoreAttributeSubTrees) { if (Collectible == null) { ResolveBlockOrItem(worldForResolve); } return (sourceStack != null && Collectible != null && Collectible.Equals(this, sourceStack, ignoreAttributeSubTrees) ); }
public void ReportItemCollected( Collectible col ) { _itemsCollected++; if(col == null) return; KillCollectibleAfterTime kcat = col.GetComponent<KillCollectibleAfterTime>(); if ( kcat != null && !kcat.isKilling && _spawnTargetActive) { col.ReportCollection(); _currentItemTarget--; } ReportScore(); if ( _spawnTargetActive ) CheckCompleteSpawnSite(); CheckBeatGame(); }
/// <summary> /// Apply the collectible effect. /// </summary> private void applyEffect(Collectible collectibleObject) { // Do nothing if already in effect if (activeCollectible == collectibleObject) { return; } // Interrupt any currently running item effects if (activeCollectible != null) { activeCollectible.cancelEffect(); Destroy(activeCollectible.gameObject); } AudioController.playSFX(collectibleObject.pickupSFX); activeCollectible = collectibleObject; collectibleObject.applyEffects(); }
void Collision(Collectible collectible) { switch (gameState) { case GameState.Title : { collectible.Splash(); Shader.SetGlobalVector("_SplashPosition", collectible.position); AudioSource.PlayClipAtPoint(clipCollision, Camera.main.transform.position); break; } case GameState.Playing : { if (collectible.GetType() == typeof(Bonus)) { collectible.Splash(); gui.SetScore(++currentScore, playerLife); Shader.SetGlobalVector("_SplashPosition", collectible.position); AudioSource.PlayClipAtPoint(clipCollision, Camera.main.transform.position); // Win check --currentBonusCount; if (currentBonusCount <= 0) { GotoTransition(); AudioSource.PlayClipAtPoint(clipWin, Camera.main.transform.position); } // Get Life Bonus bonus = (Bonus)collectible; if (bonus.type == Bonus.BonusType.Heart) { ++playerLife; gui.SetScore(currentScore, playerLife); } } else { collectible.Splash(); Shader.SetGlobalVector("_SplashPosition", collectible.position); // Game over check --playerLife; if (playerLife < 0f) { GotoOver(); AudioSource.PlayClipAtPoint(clipGameOver, Camera.main.transform.position); } else { gui.SetScore(currentScore, playerLife); playerHurted = true; GotoTransition(); AudioSource.PlayClipAtPoint(clipCollision, Camera.main.transform.position); } } break; } case GameState.Chilling : { collectible.Splash(); Shader.SetGlobalVector("_SplashPosition", collectible.position); break; } } }
public void RemoveItem(Collectible itemToRemove) { Destroy(_collection [itemToRemove].gameObject); _collection.Remove (itemToRemove); }
public void UseItem() { if(SelectedItem != null) { if(SelectedItem.GetComponent<Potion>() != null && GameController.MainCharacter.DogInventory.Count <= 0) { return; } SelectedItem.GetComponent<Item>().ActivateItem(); if (SelectedItem.GetComponent<Note>() == null) { RemoveItem(SelectedItem); if (_collection.Count > 0) DisplayFirstItem(); else SelectedItem = null; } } }
private void DisplayFirstItem() { Collectible[] keys = new Collectible[_collection.Keys.Count]; _collection.Keys.CopyTo(keys, 0); SelectedItem = keys[0]; DisplayStats(keys[0]); }
private void DisplayStats(Collectible item) { SelectedItem = item; if(item != null) { SelectedItemPortrait.sprite = item.Sprite; SelectedItemText.text = item.Description; } if(GameController.AddDogUI.GetComponent<AddDogUI>().SelectedCollectible != null && SelectedItem == GameController.AddDogUI.GetComponent<AddDogUI>().SelectedCollectible) { ActivateDogButton.SetActive(false); DeactivateDogButton.SetActive(false); } if (UseItemButton != null && SelectedItem == GameController.AddItemUI.GetComponent<AddItemUI>().SelectedCollectible) UseItemButton.SetActive(false); else if (UseItemButton != null) UseItemButton.SetActive(true); if (SelectedItem != null && SelectedItem.GetComponent<Dog>() != null && _collection.ContainsKey(SelectedItem)) { if (SelectedItem.gameObject.activeSelf) { DeactivateDogButton.SetActive (true); ActivateDogButton.SetActive (false); } else { DeactivateDogButton.SetActive (false); ActivateDogButton.SetActive (true); } } }
/// <summary> /// Reset collectible. /// </summary> private void reset() { // If there is an active item (of the collectibles), cancel its effects before removing references and destroying it if (activeCollectible != null) { activeCollectible.cancelEffect(); Destroy(activeCollectible.gameObject); activeCollectible = null; } }
/// <summary> /// Remove the effect of the collectible once the duration of effect has expired (called outside class) /// </summary> public static void finishEffect(Collectible collectibleObject) { Instance.removeEffect(collectibleObject); }
public void CollectObject(Collectible _thing) { switch (_thing.typeCollectible) { case Collectible.ListCollectible.TinyGem : { _levMan.CollectibleGathered.Add(_thing); _levMan.collecSum += _thing.value; _levMan._player.triggerNotification(_thing.value); break; } case Collectible.ListCollectible.Gatepart : { _levMan.CollectibleGathered.Add(_thing); _levMan.collecSum += _thing.value; _levMan._player.triggerNotification(_thing.value); _levMan.Gate.collectPart(_levMan.score); checkLevelCompletion(); break; } } }
public void IconClicked(Collectible item) { DisplayStats (item); }
public void AddCollectible( Collectible col ) { _collectibles.Add( col ); }
public override void Update() { if (isLifting) { } else if (isReturning) { AudioSystem.LoopSoundWhileActive(GameData.SOUND_SWITCH_HOOK_LOOP); // Return to player. Vector2F trajectory = (RoomControl.Player.Center + new Vector2F(0, 3)) - Center; if (trajectory.Length <= speed) { if (collectible != null) collectible.Collect(); Destroy(); } else { physics.Velocity = trajectory.Normalized * speed; } } else if (isHooked) { // This is the state when latched on to on object, before lifting up. timer++; if (timer >= GameSettings.SWITCH_HOOK_LATCH_DURATION) { // Start lifting if object is still alive. if (IsHookedObjectAlive()) { BeginSwitching(); } else { BeginReturn(true); } } } else { AudioSystem.LoopSoundWhileActive(GameData.SOUND_SWITCH_HOOK_LOOP); // Check for collectibles to pick up. foreach (Collectible c in Physics.GetEntitiesMeeting<Collectible>(CollisionBoxType.Soft)) { if (c.IsPickupable && c.IsCollectibleWithItems) { collectible = c; c.Destroy(); BeginReturn(true); } } // Return after extending to the maximum distance. distance += speed; if (distance >= length) BeginReturn(false); } base.Update(); // This should handle room edge collisions. if (!isReturning && !isHooked && !isLifting && physics.IsColliding) { BeginReturn(false); } }
//----------------------------------------------------------------------------- // Overridden Methods //----------------------------------------------------------------------------- public override void Initialize() { base.Initialize(); if (direction == Directions.Right) Physics.CollisionBox = new Rectangle2F(0, 0, 2, 1); else if (direction == Directions.Left) Physics.CollisionBox = new Rectangle2F(-2, 0, 2, 1); else if (direction == Directions.Up) Physics.CollisionBox = new Rectangle2F(0, -2, 1, 2); else if (direction == Directions.Down) Physics.CollisionBox = new Rectangle2F(0, 0, 1, 4); collectible = null; hookedObject = null; isReturning = false; isHooked = false; isLifting = false; distance = 0; position = HookStartPosition; physics.Velocity = Directions.ToVector(direction) * speed; Graphics.SetAnimation(GameData.ANIM_PROJECTILE_SWITCH_HOOK); }
/// <summary> /// Delete collectible effect. /// </summary> private void removeEffect(Collectible collectibleObject) { // Remove reference to the object about to be destroyed, then destroy if (activeCollectible == collectibleObject) { activeCollectible = null; } if (collectibleObject != null) { Destroy(collectibleObject.gameObject); } }
void AddCollectible(Collectible collectible) { collectibleList.Add(collectible); collisionDetector.AddCollectible(collectible); }
public void Exit() { SelectedCollectible = null; ItemInventory.gameObject.SetActive (false); gameObject.SetActive(false); }
public void Exit() { SelectedItem = null; ClearView(); gameObject.SetActive (false); }
public void AddCollectible(Collectible collectible) { Hunger += collectible.hungerAdjustment; Illness += collectible.illnessAdjustment; Happiness += collectible.happinessAdjustment; }
/// <summary> /// Call the apply effect method from outside this class /// </summary> public static void callApplyEffect(Collectible collectibleObject) { Instance.applyEffect(collectibleObject); }
void OnEnable() { PlayBackpackSound(); if (_collection.Count > 0) { DisplayFirstItem(); } else { SelectedItem = null; ClearView(); } if (UseItemButton != null) UseItemButton.SetActive(false); if(ActivateDogButton != null && DeactivateDogButton != null) { ActivateDogButton.SetActive(false); DeactivateDogButton.SetActive(false); } }
// Initialize when instantiated void Awake() { Instance = this; activeCollectible = null; }