Exemplo n.º 1
0
    public void CheckDead()
    {
        List <Character> DeadPeople = new List <Character> ();

        int o = CharacterOrder.Count;

        for (int i = 0; i < Enemy.Count; i++)
        {
            if (Enemy [i].Health <= 0)
            {
                Positions[Enemy[i].Position] = 0;
                DeadPeople.Add(Enemy [i]);
                Enemy.RemoveAt(i);
                Loot tp_loot = Loot.k_loot;
                tp_loot.DropNewItem(this);
                ExpGain += CharacterOrder [i].expGain;
            }
        }
        for (int i = 0; i < Players.Count; i++)
        {
            if (Players [i].Health <= 0)
            {
                Positions[Players[i].Position] = 0;
                DeadPeople.Add(Players [i]);
                Players.RemoveAt(i);
            }
        }

        int j = 1;

        foreach (Character tp_char in DeadPeople.ToArray())
        {
            if (CharacterCount < 6)
            {
                foreach (Character tp_ch in CharacterOrder.ToArray())
                {
                    if (tp_ch.ID == tp_char.ID)
                    {
                        if (System.Array.IndexOf(CharacterOrder.ToArray(), tp_ch) < Shift)
                        {
                            j++;
                        }
                        CharacterOrder.Remove(tp_ch);
                        CharacterCount--;
                    }
                }
            }

            if (CharacterCount >= 6)
            {
                int i = CharacterOrder.FindIndex(go => go.ID == tp_char.ID);
                CharacterOrder.RemoveAt(i);
                CharacterCount--;
            }
            for (int i = 0; i <= j; i++)
            {
                CharacterOrder.Add(CharacterOrder [Shift + i]);
            }
        }

        int[] content = new int[DeadPeople.Count];

        for (int i = 0; i < content.Length; i++)
        {
            content [i] = DeadPeople [i].ID;
        }

        RaiseEventOptions opt = new RaiseEventOptions();

        opt.TargetActors = GroupIds;
        PhotonNetwork.RaiseEvent(62, content, true, opt);

        if (Enemy.Count <= 0)
        {
//			EndBattle ();
        }
    }