コード例 #1
0
 internal void BoxInventoryShield(IGameItem shield, int?index = null, bool displayResaleValue = true)
 {
     Console.Write("\u2551");
     Console.SetCursorPosition(Console.CursorLeft + 1, Console.CursorTop);
     if (index is null)
     {
         Console.Write($"> {shield.Name}"); // Shield name
     }
     else
     {
         Console.Write($"{index} > {shield.Name}"); // Shield name with index
     }
     Console.SetCursorPosition(BlockMax - 1, Console.CursorTop);
     Console.Write("\u2551");
     Console.SetCursorPosition(BlockMin, CursorPos++);
     Console.Write("\u2551");
     Console.SetCursorPosition(Console.CursorLeft + 3, Console.CursorTop);
     Console.Write("<");
     Console.Write($"DEF: +{shield.GetAttribute()}"); // Defense Value.
     Console.Write(" | ");
     if (displayResaleValue)
     {
         Console.Write($"Value: {shield.ResaleValue}"); // Value
     }
     else
     {
         // For the store
         Console.Write($"Value: {shield.Value}"); // Value
     }
     Console.Write(">");
     Console.SetCursorPosition(BlockMax - 1, Console.CursorTop);
     Console.Write("\u2551");
     Console.SetCursorPosition(BlockMin, CursorPos++);
 }
コード例 #2
0
 internal void BoxInventoryPotion(IGameItem potion, int?index = null, bool displayResaleValue = true)
 {
     Console.Write("\u2551");
     Console.SetCursorPosition(Console.CursorLeft + 1, Console.CursorTop);
     if (index is null)
     {
         Console.Write($"> {potion.Name}"); // hero.Name
     }
     else
     {
         Console.Write($"{index} > {potion.Name}"); // hero.Name
     }
     Console.SetCursorPosition(BlockMax - 1, Console.CursorTop);
     Console.Write("\u2551");
     Console.SetCursorPosition(BlockMin, CursorPos++);
     Console.Write("\u2551");
     Console.SetCursorPosition(Console.CursorLeft + 3, Console.CursorTop);
     Console.Write("<");
     Console.Write($"Heals: +{potion.GetAttribute()}"); // Healing Value.
     Console.Write(" | ");
     if (displayResaleValue)
     {
         Console.Write($"Value: {potion.ResaleValue}"); // Value
     }
     else
     {
         // For the store
         Console.Write($"Value: {potion.Value}"); // Value
     }
     Console.Write(">");
     Console.SetCursorPosition(BlockMax - 1, Console.CursorTop);
     Console.Write("\u2551");
     Console.SetCursorPosition(BlockMin, CursorPos++);
 }
コード例 #3
0
 public void BoxInventoryArmour(IGameItem eqpdArmour, int?index = null, bool DisplayResaleValue = true)
 {
     Console.Write("\u2551");
     Console.SetCursorPosition(Console.CursorLeft + 1, Console.CursorTop);
     if (index is null)
     {
         Console.Write($"> {eqpdArmour.Name}"); // hero.Name
     }
     else
     {
         // For the store
         Console.Write($"{index} > {eqpdArmour.Name}"); // hero.Name
     }
     Console.SetCursorPosition(BlockMax - 1, Console.CursorTop);
     Console.Write("\u2551");
     Console.SetCursorPosition(BlockMin, CursorPos++);
     Console.Write("\u2551");
     Console.SetCursorPosition(Console.CursorLeft + 3, Console.CursorTop);
     Console.Write("<");
     Console.Write($"DEF: +{eqpdArmour.GetAttribute()}"); // Defense
     Console.Write(" | ");
     if (DisplayResaleValue)
     {
         Console.Write($"Value: {eqpdArmour.ResaleValue}"); // Value
     }
     else
     {
         // For the store
         Console.Write($"Value: {eqpdArmour.Value}"); // Value
     }
     Console.Write(">");
     Console.SetCursorPosition(BlockMax - 1, Console.CursorTop);
     Console.Write("\u2551");
     Console.SetCursorPosition(BlockMin, CursorPos++);
 }
コード例 #4
0
 public void BoxInventoryWeapon(IGameItem eqpdWeapon, int?index = null, bool DisplayResaleValue = true)
 {
     Console.Write("\u2551");
     Console.SetCursorPosition(Console.CursorLeft + 1, Console.CursorTop);
     if (index is null)
     {
         Console.Write($"> {eqpdWeapon.Name}"); // hero.Name
     }
     else
     {
         Console.Write($"{index} > {eqpdWeapon.Name}"); // hero.Name
     }
     Console.SetCursorPosition(BlockMax - 1, Console.CursorTop);
     Console.Write("\u2551");
     Console.SetCursorPosition(BlockMin, CursorPos++);
     Console.Write("\u2551");
     Console.SetCursorPosition(Console.CursorLeft + 3, Console.CursorTop);
     Console.Write("<");
     Console.Write($"STR: +{eqpdWeapon.GetAttribute()}"); // Strength
     Console.Write(" | ");
     if (DisplayResaleValue)
     {
         Console.Write($"Value: {eqpdWeapon.ResaleValue}"); //
     }
     else
     {
         // For the store
         Console.Write($"Value: {eqpdWeapon.Value}"); // Value
     }
     Console.Write(">");
     Console.SetCursorPosition(BlockMax - 1, Console.CursorTop);
     Console.Write("\u2551");
     Console.SetCursorPosition(BlockMin, CursorPos++);
 }
コード例 #5
0
ファイル: GameItemView.cs プロジェクト: Raniita/CatsAndMice
        public static IElementView GetView(IGameItem item, int size)
        {
            IElementView view = null;

            if (item is Fruit)
            {
                view = new FruitView(item, size);
            }
            else if (item is Poisson)
            {
                view = new PoissonView(item, size);
            }
            else if (item is SmartMouse)
            {
                view = new MouseView(item, size);
            }
            else if (item is Mouse)
            {
                view = new MouseView(item, size);
            }
            else if (item is Cat)
            {
                view = new CatView(item, size);
            }
            return(view);
        }
コード例 #6
0
        public void UpdateGameItemListTest()
        {
            GameCourseManager_Accessor target = new GameCourseManager_Accessor();


            GameItem.GameItemList = new System.Collections.Generic.LinkedList <IGameItem>();

            // Alien befindet sich in Kollision mit Spieler-Projektil
            GameItem.GameItemList.AddLast(new Alien(new Vector2(100f, 100f), GameItemConstants.AlienVelocity, GameItemConstants.AlienHitpoints, GameItemConstants.AlienDamage, GameItemConstants.AlienWeapon, GameItemConstants.AlienScoreGain));
            GameItem.GameItemList.AddLast(new Projectile(new Vector2(100f, 100f), CoordinateConstants.Up, ProjectileTypeEnum.PlayerNormalProjectile, GameItemConstants.PlayerNormalProjectileHitpoints, GameItemConstants.PlayerNormalProjectileVelocity, GameItemConstants.PlayerNormalProjectileDamage));

            // Alien ohne Kollision
            GameItem.GameItemList.AddLast(new Alien(new Vector2(10f, 10f), GameItemConstants.AlienVelocity, GameItemConstants.AlienHitpoints, GameItemConstants.AlienDamage, GameItemConstants.AlienWeapon, GameItemConstants.AlienScoreGain));

            // Nach Ausführung der Methode in der GameItem.GameItemList verbleibendes Alien
            IGameItem remainingAlien = GameItem.GameItemList.Last.Value;


            GameTime gameTime = new GameTime(new TimeSpan(0, 0, 42), new TimeSpan(0, 0, 1));

            target.UpdateGameItemList(gameTime);

            Assert.AreSame(remainingAlien, GameItem.GameItemList.First.Value);

            GameItem.GameItemList = null;
        }
コード例 #7
0
 public Torso(IGameItem gameItem, int def)
 {
     this.DefensePoints = def;
     this.Name          = gameItem.Name;
     this.ItemId        = gameItem.ItemId;
     this.Price         = gameItem.Price;
 }
コード例 #8
0
 public QuestItems(IGameItem gameItem, int quantity)
 {
     this.ItemId   = gameItem.ItemId;
     this.Price    = gameItem.Price;
     this.Name     = gameItem.Name;
     this.Quantity = quantity;
 }
コード例 #9
0
        protected override void Start()
        {
            base.Start();
            int totalLoginDays = MyPlayerPrefs.LoadInt(SaveKeyName.TotalLoginDays, 0);

            if (totalLoginDays <= 0)
            {
                totalLoginDays = 1;
            }

            int weeklyCount         = (totalLoginDays / elements.Length);
            int currentElementIndex = (totalLoginDays - 1) % elements.Length;

            for (int i = 0; i < elements.Length; i++)
            {
                int       day  = (weeklyCount * elements.Length) + i + 1;
                IGameItem item = LoginBonus.Instance.GetBonusItem(day);
                elements[i].Init(i + 1, item.Type, item.ID, item.Count, i <= currentElementIndex);

                //色変更
                if (i < currentElementIndex)
                {
                    elements[i].Color = alreadyGetElementColor;
                }
                else if (i == currentElementIndex)
                {
                    elements[i].Color = currentDayColor;
                }
                else if (i > currentElementIndex)
                {
                    elements[i].Color = willGetElementColor;
                }
            }
        }
コード例 #10
0
        public void RemoveItem(IGameItem itemToBeRemoved)
        {
            ISlot currentSlot = this.SlotList.FirstOrDefault(x => x.GameItem == itemToBeRemoved);

            currentSlot.GameItem = null;
            currentSlot.IsEmpty  = true;
        }
コード例 #11
0
ファイル: ConfigsData.cs プロジェクト: firefishes/ShipDock
        public T GetGameItem <T>(int itemType, int id) where T : IGameItem
        {
            IGameItem            result      = default;
            IGameItemCollections collections = mGameItemCollections[itemType];

            if (collections != default)
            {
                switch (itemType)
                {
                case Consts.ITEM_HERO:
                    result = (collections as HeroCollections).GetItem(id);
                    break;

                case Consts.ITEM_SKILL:
                    result = (collections as SkillCollections).GetItem(id);
                    break;

                case Consts.ITEM_SKILL_EFFECT:
                    result = (collections as SkillEffectCollections).GetItem(id);
                    break;
                }
            }
            else
            {
            }

            return((T)result);
        }
コード例 #12
0
        public void Execute(object parameter)
        {
            _item = _boatViewModel.SelectedItem;
            if (parameter is Direction direction)
            {
                switch (direction)
                {
                case Direction.North:
                    _item.Row--;
                    break;

                case Direction.East:
                    _item.Column--;
                    break;

                case Direction.South:
                    _item.Row++;
                    break;

                case Direction.West:
                    _item.Column++;
                    break;

                case Direction.Rotate:
                    ((IBoat)_item).Rotate();
                    break;

                default:
                    break;
                }
            }
            _boatViewModel.UpdateValidPlacement();
        }
コード例 #13
0
ファイル: Tile.cs プロジェクト: Team---Peach/IPeachable
 public Tile(ITerrain terrain, IGameObject actor, IGameItem item, IObject gameObj)
 {
     this.Terrain    = terrain;
     this.Actor      = actor;
     this.Item       = item;
     this.GameObject = gameObj;
 }
コード例 #14
0
ファイル: Consumable.cs プロジェクト: DanOwen91/RPGGame
 public Consumable(IGameItem gameItem, int HealthRegen)
 {
     this.HealthRegen = HealthRegen;
     this.Name        = gameItem.Name;
     this.ItemId      = gameItem.ItemId;
     this.Price       = gameItem.Price;
 }
コード例 #15
0
        /// <summary>
        /// Diese Methode wird bei einer Kollision mit einem anderen Objekt aufgerufen.
        /// Innerhalb der Methode wird der Schaden am übergebenen Objekt berechnet,
        /// oder PowerUps angewendet. Außerdem wird das <c>Hit</c>-Event ausgelöst.
        /// </summary>
        /// <remarks>
        /// Bei der Kollisionsprüfung wird nur verhindert, dass zwei gleichartige Objekte kollidieren.
        /// Deshalb muss in dieser Methode geprüft werden, ob eine Kollision mit dem übergebenen Objekt überhaupt sinnvoll ist.
        /// </remarks>
        /// <param name="collisionPartner">Das GameItem mit dem die Kollision stattfand.</param>
        public override void IsCollidedWith(IGameItem collisionPartner)
        {
            // Wenn der Spieler unverwundbar ist, kann hier schon abgebrochen werden
            if (IsInvincible)
            {
                return;
            }

            // Spieler können mit gegnerischen Projektilen und Schiffen kollidieren
            // Außerdem auch mit PowerUps, aber die müssen hier nicht behandelt werden, sondern nur in deren IsCollidedWith-Methode
            if (!(collisionPartner is Enemy) && !(collisionPartner is Projectile))
            {
                return;
            }

            if (collisionPartner is Projectile)
            {
                // Spieler kann nicht mit seinen eigenen Projektilen kollidieren
                Projectile projectile = (Projectile)collisionPartner;
                if ((projectile.ProjectileType == ProjectileTypeEnum.PlayerNormalProjectile) ||
                    (projectile.ProjectileType == ProjectileTypeEnum.PiercingProjectile))
                {
                    return;
                }
            }

            // Wenn der Programmfluss hier ankommt gibt es eine Kollision
            if (Player.Hit != null)
            {
                Player.Hit(this, EventArgs.Empty);
            }
            Hitpoints -= collisionPartner.Damage;
        }
コード例 #16
0
    /// <summary>Create and return a new InventoryItem from a GameItem, with optional count.</summary>
    public static InventoryItem Create(IGameItem item, uint count = 0)
    {
        InventoryItem stack = item.CreateInventoryItem();

        stack.count = count;
        return(stack);
    }
コード例 #17
0
        /// <summary>
        /// Löscht tote IGameItem aus der Controllees Liste
        /// </summary>
        /// <param name="sender">Das zu löschende Alien</param>
        /// <param name="e">Leere event args</param>
        /// <remarks>
        /// Behandelt das Destroyed Ereignis der Alienklasse
        /// </remarks>
        protected override void Alien_Destroyed(object sender, System.EventArgs e)
        {
            IGameItem item = (IGameItem)sender;

            /* modified by CK 4.7.11
             * Überprüft ob Eventsender ein Alien dieses Controllers ist.Wenn ja,
             * wird Alien aus den Listen dieses Controllers gelöscht und geg. Falls
             * löscht sich der gesammte Controller
             */
            if (this.Controllees.Remove(item))
            {
                // <STST>
                // Alien aus AlienMatrix
                LinkedList <IGameItem> remList = this.AlienMatrix.Where(x => x.Contains(item)).SingleOrDefault();
                if (remList != null)
                {
                    remList.Remove(item);
                }
                // </STST>

                if (this.Controllees.Count == 0)
                {
                    controllerManager.Controllers.Remove(this);
                }
            }
        }
コード例 #18
0
    /// <summary>Try and store one or more IGameItems into the inventory.</summary>
    /// See <see cref="InventorySpace.Store(InventoryItem)"/> for more details.
    public InventoryResult Store(IGameItem item, uint count = 1)
    {
        InventoryItem toStore = item.CreateInventoryItem();

        toStore.count = count;
        return(Store(toStore));
    }
コード例 #19
0
 public override void Execute()
 {
     for (int i = 0; i < this.Engine.NumberOfItems; i++)
     {
         IGameItem newItem = ItemFactory.Instance.CreateItem();
         this.Engine.AddItem(newItem);
     }
 }
コード例 #20
0
 private void CheckForItemHeightInY(IGameItem item, TypeOfItem typeOfItem)
 {
     //Check if the object is below the ball level, that is below the ground, disable it
     if (item.Me.transform.position.y < gameInfo.ballRestPositionY)
     {
         ResetItem(item, typeOfItem);
     }
 }
コード例 #21
0
ファイル: Weapon.cs プロジェクト: DanOwen91/RPGGame
 public Weapon(IGameItem gameItem, int minDamage, int maxDamage)
 {
     this.MinimumDamage = minDamage;
     this.MaxDamage     = MaxDamage;
     this.Name          = gameItem.Name;
     this.ItemId        = gameItem.ItemId;
     this.Price         = gameItem.Price;
 }
コード例 #22
0
ファイル: GameLogic.cs プロジェクト: ggraca/sacrifitem
 private void ClearSlots()
 {
     ClearSlot("EquipedSlot");
     ClearSlot("DiscardedSlot1");
     ClearSlot("DiscardedSlot2");
     equiped    = null;
     discarded  = null;
     discarded2 = null;
 }
コード例 #23
0
        // ADDED (by STST): 2.7.2011
        /// <summary>
        /// Löscht sich aus ControllerManager.Controllers-Liste, falls Alien zerstört wurde.
        /// </summary>
        /// <param name="sender">Das zu löschende Alien</param>
        /// <param name="e">Leere event args</param>
        /// <remarks>
        /// Behandelt das Destroyed Ereignis der Alienklasse
        /// </remarks>
        protected virtual void Alien_Destroyed(object sender, System.EventArgs e)
        {
            IGameItem item = (IGameItem)sender;

            if (this.Controllee == item)
            {
                controllerManager.Controllers.Remove(this);
            }
        }
コード例 #24
0
        //[SerializeField]
        //Panel panel = null;

        public void PresentItem(IGameItem item)
        {
            //panel.Activate();

            //if(item.Type == ItemType.VirtualCoin)
            //{
            //    StartCoroutine(new MyCoroutine(PresentGem(item.Count)).OnCompleted(() => panel.Deactivate()));
            //}
        }
コード例 #25
0
    /// <summary>Get the total number of `item` stored in all inventories.</summary>
    public ulong Count(IGameItem item)
    {
        ulong count = 0;

        foreach (InventorySpace space in stores)
        {
            count += space.Count(item);
        }
        return(count);
    }
コード例 #26
0
ファイル: GameItemView.cs プロジェクト: Raniita/CatsAndMice
        protected GameItemView(IGameItem item, int size)
        {
            this.item = (item != null) ? item : new Fruit();

            this.item = item;
            this.size = size;
            offset    = size / 2;
            x         = (item.Coords.Columna * size) - offset;
            y         = (item.Coords.Fila * size) - offset;
        }
コード例 #27
0
        // MODIFIED (by STST): 2.7.2011
        /// <summary>
        /// Generiert eine neue Instanz der <see cref="KeyboardController"/> Klasse.
        /// </summary>
        public KeyboardController(ControllerManager controllerManager, IGameItem controllee)
            : base(controllerManager, controllee)
        {
            this.KBconfig = KeyboardConfig.Default;

            if (this.Controllee is Player)
            {
                myPlayer = (Player)Controllee;
            }
        }
コード例 #28
0
        public void LootItem(IGameItem itemToBeLooted)
        {
            ISlot emptySlot = this.SlotList.FirstOrDefault(x => x.IsEmpty);

            if (emptySlot == null)
            {
                throw new BackPackFullException("Your backpack is full.");
            }

            emptySlot.GameItem = itemToBeLooted;
            emptySlot.IsEmpty  = false;
        }
コード例 #29
0
 /// <summary>
 /// Elimina un elemento del juego.
 /// </summary>
 /// <param name="item"></param>
 private void RemoveItem(IGameItem item)
 {
     if (item == null)
     {
         return;
     }
     gameItems.Remove(item);
     if (board[item.Coords.Fila, item.Coords.Columna] == item)
     {
         board[item.Coords.Fila, item.Coords.Columna] = null;
     }
 }
コード例 #30
0
 /// <summary>Return the amount of items of this type that can be stored.</summary>
 public ulong GetSpaceFor(IGameItem item)
 {
     if (isAccessible)
     {
         float volume = item.Volume;
         return((ulong)Mathf.Floor(capacity / volume));
     }
     else
     {
         return(0);
     }
 }