Beispiel #1
0
 //  protected CheckPoint currentCheckpoint = null;
 public Vector3 PositionToRespawn(PlayersID player)
 {
     if (callbackKill != null)
     {
         callbackKill(currentsCheckPoint[player]);
     }
     return(currentsCheckPoint[player].transform.position);
 }
Beispiel #2
0
 public Vector3?getPosition(PlayersID player)
 {
     if (!currentsCheckPoint.ContainsKey(player))
     {
         return(null);
     }
     return(currentsCheckPoint[player].transform.position);
 }
Beispiel #3
0
 void OnSetKey(PlayersID id, int value)
 {
     if (id == PlayersID.Player1Klaus)
     {
         SetKlausKey(value);
     }
     else if (id == PlayersID.Player2K1)
     {
         SetK1Key(value);
     }
 }
Beispiel #4
0
        public void GetPlayerIDs()
        {
            if (string.IsNullOrEmpty(PlayersIDString))
            {
                return;
            }

            var splitted = PlayersIDString.Split(' ');

            foreach (var id in splitted)
            {
                PlayersID.Add(int.Parse(id));
            }
        }
Beispiel #5
0
    public bool useKey(PlayersID id, int number)
    {
        if (number > 0 && keys.ContainsKey(id) && keys [id] >= number)
        {
            keys [id] -= number;
            if (!object.ReferenceEquals(onKey, null))
            {
                onKey(id, keys [id]);
            }
            return(true);
        }

        return(false);
    }
Beispiel #6
0
 public void AddPosition(PlayersID player, CheckPoint pos)
 {
     if (currentsCheckPoint.ContainsKey(player))
     {
         if (currentsCheckPoint[player] != pos)
         {
             currentsCheckPoint[player].ResetCheckPoint(player);
         }
         currentsCheckPoint[player] = pos;
     }
     else
     {
         currentsCheckPoint.Add(player, pos);
     }
 }
Beispiel #7
0
 public void AddKey(PlayersID id)
 {
     if (keys.ContainsKey(id))
     {
         keys [id] += 1;
     }
     else
     {
         keys.Add(id, 1);
     }
     if (!object.ReferenceEquals(onKey, null))
     {
         onKey(id, keys [id]);
     }
 }
Beispiel #8
0
 public bool AddPlayer(PlayersID player, int connectionId)
 {
     if (currentPlayers.ContainsValue(player))
     {
         Debug.LogError("CRITICAL ERROR ENCONTRAMOS EL BUG: Se intentó agregar más de una vez un " + player + " en el room " + roomId);
     }
     if (!currentPlayers.ContainsKey(connectionId))
     {
         currentPlayers.Add(connectionId, player);
         return(true);
     }
     else
     {
         Debug.LogError("Se intentó agregar dos veces al jugador con ip " + connectionId + " al room" + roomId);
         return(false);
     }
 }
Beispiel #9
0
            public void StartGame(List <DTOPlaying> players)
            {
                //cc.Add(new CliChat())

                List <DTOPlaying> pls  = players.ToList();
                DTOPlaying        temp = null;

                foreach (DTOPlaying C in pls)
                {
                    if (PlayersID.FirstOrDefault(x => x.Value == 1).Key == C.name)
                    {
                        // If we are ourselves, do nothing
                        temp = C;
                        chatClientsVectorClock.Add(C.name, 0);
                    }
                    else
                    {
                        //else add respective player to players list
                        PlayersID.Add(C.name, pacID++);
                        chatClientsVectorClock.Add(C.name, 0);
                        String[] splitUrl = C.url.Split(new Char[] { ':', '/' });
                        ///  A : / / B : C / D
                        ///  0  1 2  3   4   5
                        Clients.Add(splitUrl[4], "tcp://" + splitUrl[3] + "/" + splitUrl[4] + "/chatClientServerService");
                    }
                }
                if (temp != null)
                {
                    pls.Remove(temp);
                }
                registerChatClients(this, new PacEventArgs(pls));


                foreach (KeyValuePair <String, int> p in PlayersID)
                {
                    //TURNS PACMAN PLAYERS VISIBLE
                    changePacmanVisibility(this, new PacEventArgs(p.Value));
                }

                launch_mainloop(this, new PacEventArgs(0));
                running = true;
            }
Beispiel #10
0
    public void ResetCheckPoint(PlayersID player)
    {
        isUsed[player] = false;
        Dictionary <PlayersID, bool> .ValueCollection pare = isUsed.Values;
        bool changueColor = true;

        foreach (bool s in pare)
        {
            if (s)
            {
                changueColor = false;
                break;
            }
        }
        if (changueColor)
        {
            //     Debug.Log("Cambiar color");

            sprite.color = baseColor;
        }
        //enabled = true;
    }
Beispiel #11
0
    public void AddFightCheckpoint(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            PlayersID id = other.GetComponent <PlayerInfo>().playerType;
            if (!isUsed.ContainsKey(id))
            {
                isUsed[id] = false;
            }

            if (!isUsed[id])
            {
                if (sprite)
                {
                    sprite.color = onColor;
                }
                RotateArrow();
                ManagerCheckPoint.Instance.AddPosition(id, this);
                isUsed[id] = true;
            }
        }
    }
Beispiel #12
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            if (other.GetComponent <FSMSystem>().CurrentStateID == StateID.Dead)
            {
                return;
            }
            PlayersID id = other.GetComponent <PlayerInfo>().playerType;
            if (!isUsed.ContainsKey(id))
            {
                isUsed[id] = false;
            }
            if (!isUsed[id])
            {
                sprite.color = onColor;

                RotateArrow();
                ManagerCheckPoint.Instance.AddPosition(id, this);
                isUsed[id] = true;
                // enabled = false;
            }
        }
    }
Beispiel #13
0
 public void ActivateCHeckpoint(PlayersID player)
 {
     currentsCheckPoint[player].RotateArrow();
     currentsCheckPoint[player].CheckPointUsed();
 }