private static void respawnPlayer(DegatsJoueur joueur, int number)
 {
     if (joueur)
     {
         if (!(joueur.getSiJoueurEstEnVie()))
         {
             Debug.Log("INFO    Player " + joueur.gameObject.name + " respawns.");
             if (number < respawnPoints.Count)
             {
                 joueur.reapparaitreJoueur(number);
             }
             else
             {
                 Debug.LogWarning("WARN    GestionnaireReapparition::respawnPlayer: INVALID RESPAWN INDEX!!!");
             }
         }
         else
         {
             Debug.LogWarning("WARN    GestionnaireReapparition::respawnPlayer: Respawn event called on an alive player!!!");
         }
     }
     else
     {
         Debug.LogWarning("WARN    GestionnaireReapparition::respawnPlayer: Event called on an invalid Player entity.");
     }
 }
예제 #2
0
    private void OnEnable()
    {
        if (this.gameObject.GetComponent <mouvement>() != null)
        {
            GestionnaireEvenement.ajouterEvenement("directionChanger", changerDirection);
        }
        this.prevPos = this.transform.position;

        VieJoueur vie = this.GetComponent <VieJoueur>();

        if (vie != null)
        {
            vie.setEstLocal(this.estLocal);
        }
        else
        {
            Debug.LogWarning("WARN    ManagerJoueur::OnEnable: Missing VieJoueur component.");
        }

        DegatsJoueur dgJ = this.GetComponent <DegatsJoueur>();

        if (dgJ != null)
        {
            dgJ.setSiJoueurLocal(this.estLocal);
        }
        else
        {
            Debug.LogWarning("WARN    ManagerJoueur::OnEnable: Missing DegatsJoueur component.");
        }
    }
예제 #3
0
    void onUserRespawn(SocketIOEvent obj)
    {
        Debug.Log(obj);
        int    point     = JsonToInt(obj.data.GetField("pointRespawn").ToString());
        string nomJoueur = JsonToString(obj.data.GetField("nomJoueur").ToString(), "\"");
        //Debug.Log(point + " " + nomJoueur);
        GameObject   joueur       = GameObject.Find(nomJoueur);
        DegatsJoueur degatsJoueur = joueur.GetComponent <DegatsJoueur>();

        GestionnaireReapparition.getEvent().Invoke(degatsJoueur, point);
    }
예제 #4
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        Debug.Log("INFO    ObstacleEnvironnemental:OnCollisionEnter2D(Collision2D collision) triggered for " + this.gameObject.name);
        VieJoueur    vieJ  = collider.gameObject.GetComponent <VieJoueur>();
        DegatsJoueur testJ = collider.gameObject.GetComponent <DegatsJoueur>();

        if (vieJ && testJ)
        {
            Vector3 force3d = collider.gameObject.transform.position - this.gameObject.transform.position;
            Vector2 force2d = new Vector2(force3d.x, force3d.y);
            testJ.repousserJoueur(force2d, this.dmg * 32.0f);
            vieJ.faireDegat(this.dmg);
        }
        else
        {
            Debug.Log("INFO    ObstacleEnvironnemental:OnCollisionEnter2D(Collision2D collision) Colliding entity is not a player.");
        }
    }
예제 #5
0
    private static void damagePlayer(VieJoueur joueur)
    {
        DegatsJoueur test_joueur = joueur.gameObject.GetComponent <DegatsJoueur>();

        if (test_joueur)
        {
            if (joueur.getIfAlive())
            {
                test_joueur.affichageDegats();
            }
            else
            {
                Debug.Log("INFO    GestionnaireDegats::dmgPlayer: Dead player " + joueur.gameObject.name + " took damage while dead.");
            }
        }
        else
        {
            Debug.LogWarning("WARN    GestionnaireDegats::dmgPlayer: Damage Event called on an invalid Player entity.");
        }
    }
예제 #6
0
    private static void killPlayer(VieJoueur joueur)
    {
        DegatsJoueur test_joueur = joueur.gameObject.GetComponent <DegatsJoueur>();

        if (test_joueur)
        {
            if (joueur.getIfAlive())
            {
                Debug.Log("INFO    Player " + joueur.gameObject.name + " died.");
                test_joueur.tuerJoueur();
            }
            else
            {
                Debug.LogWarning("WARN    GestionnaireMort:killPlayer(" + joueur.gameObject.name + "): Death event called on a dead player!!!");
            }
        }
        else
        {
            Debug.LogWarning("WARN    GestionnaireMort:killPlayer(" + joueur.gameObject.name + "): Event called on an invalid Player entity.");
        }
    }