Exemple #1
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.");
        }
    }
Exemple #2
0
 // Enabled
 private void OnEnable()
 {
     this.joueurs      = new VieJoueur[4];
     this.labelsVie    = new Text[4];
     this.labelsVie[0] = this.vie1;
     this.labelsVie[1] = this.vie2;
     this.labelsVie[2] = this.vie3;
     this.labelsVie[3] = this.vie4;
     GestionnaireEvenement.ajouterEvenement("vieChanger", vieJoueur);
 }
Exemple #3
0
    // Start is called before the first frame update
    void Start()
    {
        StartCoroutine(ConnectToServer());
        socket.On("USER_CONNECTED", OnUserConnected);
        socket.On("PLAY", OnUserPlay);
        socket.On("MOVE", onUserMove);
        socket.On("USER_DISCONNECTED", onUserDisconnected);
        socket.On("AUCUNE_SESSION_DISPO", onAucuneSessionDispo);
        socket.On("ITEM_PICKUP_RESPONSE", onItemPickupResponce);
        socket.On("PLAYER_PICKUP_ITEM", onOtherPlayerPickup);
        socket.On("PLAYER_LOSE_HEALTH", onPlayerTakingDamage);
        socket.On("DROP_RESPONSE", onUserDropItem);
        socket.On("UN_JOUEUR_EST_MORT", onUserDeath);
        socket.On("RESPAWN", onUserRespawn);
        socket.On("SPAWN_ARME", onWeaponSpawn);
        socket.On("FIRE_BOW", onUserFireBow);
        socket.On("GAME_OVER", onGameOver);
        socket.On("BEGIN_GAME", onGameBegin);
        GestionnaireAttaque.ajouterEvenement("VieJ1Changer", onHitPlayer);
        GestionnaireItem.ajouterEvenement("Ramassable", onUserPickupItem);
        GestionnaireEvenement.ajouterEvenement("ObjetLancer", onPlayerDropItem);
        GestionnaireEvenement.ajouterEvenement("JoueurMort", onPlayerDeath);
        GestionnaireEvenement.ajouterEvenement("arcTirer", onArcTirer);
        //joystick.gameObject.SetActive(false);
        loginPanel.playBtn.onClick.AddListener(OnClickPlayBtn);
        //joystick.OnCommandMove += OnCommandMove;

        if (this.UITime == null)
        {
            Debug.LogWarning("WARN    " + this.gameObject.name + ":Controller::start(): No GameObject set for countdown display; timer will not work.");
        }
        else if (this.UITime.GetComponent <UI_Time>() == null)
        {
            Debug.LogWarning("WARN    " + this.gameObject.name + ":Controller::start(): No UI_Time script set for countdown display; timer will not work.");
        }
    }