Пример #1
0
    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;
        }
    }
Пример #2
0
 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>();
 }
Пример #4
0
    private void Awake()
    {
        collectible = GetComponentInChildren<Collectible>();
        if (collectible != null)
            collectible.OnCollect += OnCollect;

        lifeCooldown = MinLifeTime;
    }
Пример #5
0
    public void DropCollectible()
    {
        if (!collectible)
        {
            return;
        }

        collectible.Release();
        collectible = null;
    }
Пример #6
0
 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();
 }
Пример #7
0
    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));
    }
Пример #8
0
        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);
        }
Пример #9
0
        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);
        }
Пример #10
0
    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);
    }
Пример #11
0
 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);
     }
 }
Пример #12
0
        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;
        }
Пример #13
0
 void ClearLevel()
 {
     for (int i = 0; i < collectibleList.Count; ++i)
     {
         Collectible collectible = collectibleList[i];
         if (collectible.isHitted == false)
         {
             collectible.Splash();
         }
     }
 }
Пример #14
0
    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;
        }
    }
Пример #15
0
        /// <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);
        }
Пример #16
0
        public void InvalidFloorIDsRaiseExceptionTest()
        {
            var badFloorID = TestEntities.TestBlock.ID;

            void TestCode()
            {
                var _ = new Collectible(badFloorID, "will fail", "", "");
            }

            Assert.Throws <ArgumentOutOfRangeException>(TestCode);
        }
Пример #17
0
    public override void OnHitCollectible(Collectible collectible)
    {
        base.OnHitCollectible(collectible);

        if (!canGatherCollectibles)
        {
            return;
        }

        ReturnToThrower();
    }
Пример #18
0
    public static EntityState[] AccessHolders(CollectibleInstances collectibleName)
    {
        Collectible thisEvent = null;

        EntityState[] holders = null;
        if (collectibleDictionary.TryGetValue(collectibleName, out thisEvent))
        {
            holders = thisEvent.Holders();
        }
        return(holders);
    }
Пример #19
0
    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);
    }
Пример #20
0
    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);
    }
Пример #21
0
    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();
        }
    }
Пример #22
0
        private void RemoveItem(Collectible item)
        {
            if (!items.Contains(item))
            {
                return;
            }

            items.Remove(item);
            UnMountItem(item);
            SendItemRemovedEvent(item);
        }
Пример #23
0
    public void Drop()
    {
        if (this.collectible == null)
        {
            return;
        }

        this.collectible.Unstick();
        this.rigidbody.AddExplosionForce(10, this.transform.position, 1f);
        this.collectible = null;
    }
Пример #24
0
        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);
        }
Пример #25
0
    /*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);
    }
Пример #26
0
    public void ReturnCollectible()
    {
        if (current == null) {
            return;
        }

        current.Destination.GetComponent<Animator>().SetBool("Blinking", false);
        current.ReturnToOrigin();
        musicPlayer.StopPlaying(current.Type);
        current = null;
    }
Пример #27
0
    public void OnItemCollected(Collectible collectible, int amount = 1)
    {
        string itemName = collectible.itemPrefab.name;

        OnItemCollected(itemName, amount);

        if (itemName == "TriforcePiece")
        {
            collectible.GetComponent <Triforce>().Fanfare();
        }
    }
Пример #28
0
    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;
            }
        }
    }
Пример #29
0
    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);
    }
Пример #30
0
    // 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);
        }
    }
Пример #31
0
 public void RemovedFromCollection(Collectible collectibleObj)
 {
     for (var index = collectablesList.Count - 1; index >= 0; index--)
     {
         var obj = collectablesList[index];
         if (obj == collectibleObj)
         {
             collectablesList.Remove(collectibleObj);
         }
     }
 }
Пример #32
0
 //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 });
     }
 }
Пример #33
0
        internal void RemoveCollectibleAnnotation(Collectible collectible)
        {
            ARAnnotationItem item;

            if (m_collectibleItems.TryGetValue(collectible.Id, out item))
            {
                m_collectibleItems.Remove(collectible.Id);

                CollectibleTable.RemoveItem(item);
            }
        }
Пример #34
0
 public void OpenDoor(Collectible obj)
 {
     if (list.collectablesList.Contains(obj))
     {
         canOpen = true;
     }
     else
     {
         textCanvas.SetActive(true);
     }
 }
Пример #35
0
        public void InvalidItemIDsRaiseExceptionTest()
        {
            var badItemID = TestParquets.TestBlock.ID;

            void TestCode()
            {
                var _ = new Collectible(newCollectibleID, "will fail", in_itemID: badItemID);
            }

            Assert.Throws <ArgumentOutOfRangeException>(TestCode);
        }
Пример #36
0
    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>());
    }
Пример #37
0
        /// <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)
                );
        }
Пример #38
0
    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();
    }
Пример #39
0
    /// <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();
    }
Пример #40
0
    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;
            }
        }
    }
Пример #41
0
 public void RemoveItem(Collectible itemToRemove)
 {
     Destroy(_collection [itemToRemove].gameObject);
     _collection.Remove (itemToRemove);
 }
Пример #42
0
    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;
            }
        }
    }
Пример #43
0
 private void DisplayFirstItem()
 {
     Collectible[] keys = new Collectible[_collection.Keys.Count];
     _collection.Keys.CopyTo(keys, 0);
     SelectedItem = keys[0];
     DisplayStats(keys[0]);
 }
Пример #44
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);
            }
        }
    }
Пример #45
0
 /// <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;
     }
 }
Пример #46
0
 /// <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);
 }
Пример #47
0
    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;
        }

        }
    }
Пример #48
0
 public void IconClicked(Collectible item)
 {
     DisplayStats (item);
 }
Пример #49
0
 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);
        }
Пример #52
0
 /// <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);
     }
 }
Пример #53
0
 void AddCollectible(Collectible collectible)
 {
     collectibleList.Add(collectible);
     collisionDetector.AddCollectible(collectible);
 }
Пример #54
0
 public void Exit()
 {
     SelectedCollectible = null;
     ItemInventory.gameObject.SetActive (false);
     gameObject.SetActive(false);
 }
Пример #55
0
 public void Exit()
 {
     SelectedItem = null;
     ClearView();
     gameObject.SetActive (false);
 }
Пример #56
0
	public void AddCollectible(Collectible collectible) {
		Hunger += collectible.hungerAdjustment;
		Illness += collectible.illnessAdjustment;
		Happiness += collectible.happinessAdjustment;
	}
Пример #57
0
 /// <summary>
 /// Call the apply effect method from outside this class
 /// </summary>
 public static void callApplyEffect(Collectible collectibleObject)
 {
     Instance.applyEffect(collectibleObject);
 }
Пример #58
0
    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);
        }
    }
Пример #59
0
 // Initialize when instantiated
 void Awake()
 {
     Instance = this;
     activeCollectible = null;
 }