示例#1
0
        /// <inheritdoc cref="BowWeaponItem"/>
        public override void Attack()
        {
            if (Projectile == null || !CanAttack)
            {
                return;
            }

            var projectile = MonoUtil.Load(Projectile);

            projectile.transform.position = Util.GetCharacterTransform().position;
            projectile.transform.right    = Util.GetDirectionTowardsCursor(projectile.transform);

            // Updates texture for dagger
            try
            {
                projectile.transform.GetChild(0).GetChild(0).GetComponent <SpriteRenderer>().sprite =
                    Info.Prefabs[0].transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
            }
            catch (Exception)
            {
                // ignored
            }

            SetCollDown();
            MonoUtil.Remove(projectile, 6);

            Durability -= EquipableData.DurabilityReducer;
        }
 /// <summary>
 /// Destroys object that was loaded into game world when mounted,
 /// called on dismount
 /// </summary>
 /// <returns>Whether or not item was successfully dismounted</returns>
 protected override bool OnDismount()
 {
     if (_cachedInstance != null)
     {
         MonoUtil.Remove(_cachedInstance);
     }
     return(base.OnDismount());
 }
示例#3
0
        /// <summary>
        /// Adds visual effect onto player when used
        /// TODO: Better effect fetcher
        /// </summary>
        protected virtual void LoadEffect()
        {
            var effectName = "healing";

            if (PotionInfo.EffectAmount.Magic > 0)
            {
                effectName = "healing_mp";
            }

            var effectPrefab = Resources.Load <GameObject>($"Prefabs/Player/Effects/prefab_player_effect_{effectName}");
            var effect       = MonoUtil.Load(effectPrefab);

            effect.transform.position = Util.GetCharacterTransform().position;
            effect.transform.parent   = Camera.main.transform;
            MonoUtil.Remove(effect, 3);
        }
示例#4
0
        /// <summary>
        /// Initiates projectile towards mouse
        /// </summary>
        public override void Attack()
        {
            if (Projectile == null || !CanAttack)
            {
                return;
            }

            var projectile = MonoUtil.Load(Projectile);

            projectile.transform.position = Util.GetCharacterTransform().position;
            projectile.transform.right    = Util.GetDirectionTowardsCursor(projectile.transform);
            MonoUtil.Remove(projectile, 12);

            SetCollDown();

            base.Attack();
        }