Beispiel #1
0
        public override void processMessage(MessageArrivedEventArgs messageArgs)
        {
            int typeId    = messageArgs.message.getInt("skillTypeId");
            int slotIndex = messageArgs.message.getInt("slotIndex");

            Player player;

            if (Game.clientPlayerMap.TryGetValue(messageArgs.sender, out player))
            {
                Type skillType = TypeIdGenerator.skillTypesByIds[typeId].GetType();

                if (player.skills.Any(s => s.GetType() == skillType))
                {
                    return;
                }

                Skill skill = Activator.CreateInstance(skillType, player) as Skill;

                int price = skill.UnlockPrice + player.skills.Count * 2;
                if (skill != null && player.SpendGold(price))
                {
                    player.skills.Add(skill);
                    OM_SkillUnlocked.SendMessage(player, typeId, slotIndex);
                    OM_PlayerGoldInfo.SendMessage(player);
                }
            }
        }
Beispiel #2
0
 private void OnDied()
 {
     if (lastHitStamp != null)
     {
         arena.roundStats.PlayerKilledOpponent(lastHitStamp, this);
         lastHitStamp.UpdateGold(lastHitStamp.gold + LAST_HIT_GOLD);
         OM_PlayerGoldInfo.SendMessage(lastHitStamp);
         lastHitStamp = null;
     }
 }
Beispiel #3
0
        protected override void OnContact(List <Player> players, List <Obstacle> obstacles)
        {
            int   goldMade     = 0;
            float damageAmount = damage * (1 + RandomInstance.instance.Next(21) / 100f - 0.1f);  // random +- %10

            foreach (var p in players)
            {
                p.FlyRequest(p.position + ((p.position - position).normalized + movementDirection.normalized).normalized * 3); // ucus mesafesi 3 birim

                if (!p.effects.hasShield)
                {
                    p.DealDamage(damageAmount, senderPlayer);
                    OM_PlayerHealthInfo.SendMessage(senderPlayer.arena, p);

                    if (p != senderPlayer)
                    {
                        goldMade++;
                    }
                }
                else
                {
                    p.effects.hasShield = false;
                    OM_ShieldConsumed.SendMessage(p.arena, p);
                    p.UpdateGold(p.gold + 1);
                    OM_PlayerGoldInfo.SendMessage(p);
                }
            }

            foreach (var o in obstacles)
            {
                o.DealDamage(damageAmount);
                OM_ObstacleHealthInfo.SendMessage(arena, o, position);
            }

            OM_MissileExplode.SendMessage(senderPlayer.arena, this);
            awaitsDestruction = true;

            if (goldMade != 0 && senderPlayer != null)
            {
                arena.roundStats.PlayerHit(senderPlayer);
                senderPlayer.UpdateGold(senderPlayer.gold + goldMade);
                OM_PlayerGoldInfo.SendMessage(senderPlayer);
            }
        }