public void Activate()
    {
        /* This method sets this pickup to a random effect, makes it active then
         * spawns it. The position is set in the object so no need pass it.
         */
        active        = true;
        currentEffect = effects[Random.Range(0, effects.Count)];

        pickupControl.pickupList.MakeUnavailable(this);
        SpawnSprite();
    }
Пример #2
0
        public DropItem(string InPrefab, IDropDownEffect InDropdownEffect, IPickupEffect InPickupEffect)
        {
            this.Prefab         = InPrefab;
            this.DropDownEffect = InDropdownEffect;
            this.PickupEffect   = InPickupEffect;
            if (!string.IsNullOrEmpty(this.Prefab))
            {
                GameObject original = Singleton <DropItemMgr> .instance.FindPrefabObject(this.Prefab);

                if (original != null)
                {
                    this.ItemObject          = (GameObject)UnityEngine.Object.Instantiate(original);
                    this.CachedItemTransform = (this.ItemObject == null) ? null : this.ItemObject.transform;
                }
            }
            if (InDropdownEffect != null)
            {
                InDropdownEffect.Bind(this);
            }
            if (InPickupEffect != null)
            {
                InPickupEffect.Bind(this);
            }
        }
Пример #3
0
        public DropItem(string InPrefab, IDropDownEffect InDropdownEffect, IPickupEffect InPickupEffect)
        {
            this.Prefab         = InPrefab;
            this.DropDownEffect = InDropdownEffect;
            this.PickupEffect   = InPickupEffect;
            if (!string.IsNullOrEmpty(this.Prefab))
            {
                GameObject gameObject = Singleton <DropItemMgr> .get_instance().FindPrefabObject(this.Prefab);

                if (gameObject != null)
                {
                    this.ItemObject          = (GameObject)Object.Instantiate(gameObject);
                    this.CachedItemTransform = ((!(this.ItemObject != null)) ? null : this.ItemObject.transform);
                }
            }
            if (InDropdownEffect != null)
            {
                InDropdownEffect.Bind(this);
            }
            if (InPickupEffect != null)
            {
                InPickupEffect.Bind(this);
            }
        }
Пример #4
0
        public DropItem CreateItem(string InPrefab, IDropDownEffect InDropdownEffect, IPickupEffect InPickupEffect)
        {
            DropItem dropItem = new DropItem(InPrefab, InDropdownEffect, InPickupEffect);

            this.ActiveItems.Add(dropItem);
            return(dropItem);
        }