Esempio n. 1
0
    public void CmdInitPlanete(NetworkInstanceId networkIdJoueur, string nomPlateau)
    {
        Debug.Log("Begin CmdInitPlanete");
        GameObject goPlateau = GameObject.Find(nomPlateau);

        GameObject carteplaneteGO = Instantiate <GameObject> (ConstanteInGame.cartePlanetePrefab);

        carteplaneteGO.transform.SetParent(goPlateau.transform);
        carteplaneteGO.transform.localPosition = new Vector3(0, 0, -3);
        carteplaneteGO.transform.localRotation = Quaternion.identity;
        carteplaneteGO.transform.localScale    = Vector3.one;

        cartePlanetJoueur = carteplaneteGO.GetComponent <CartePlaneteMetier> ();

        if (null != cartePlanetJoueur)
        {
            cartePlanetJoueur.initPlaneteServer(this.netId, pseudo);
        }

        NetworkServer.Spawn(carteplaneteGO);

        RpcGeneratePlanete(carteplaneteGO, NetworkInstanceId.Invalid);

        Debug.Log("End CmdInitPlanete");
    }
Esempio n. 2
0
    public void sacrificeCarte()
    {
        CartePlaneteMetier cartePlanete = CartePlaneteMetier.getPlaneteEnnemie(idJoueurProprietaire);

        //TODO point de degat ou cout carte?
        cartePlanete.recevoirDegat(getPointDegat(), this, NetworkInstanceId.Invalid);
        JoueurUtils.getJoueurLocal().CmdCreateTask(this.netId, this.idJoueurProprietaire, cartePlanete.IdISelectionnable, ConstanteIdObjet.ID_CONDITION_ACTION_DESTRUCTION_CARTE, NetworkInstanceId.Invalid, false);           //TODO idEventTask provenance?
    }
Esempio n. 3
0
    public void RpcGeneratePlanete(GameObject goScript, NetworkInstanceId networkIdJoueur)
    {
        Debug.Log("Begin RpcGeneratePlanete");

        if (NetworkInstanceId.Invalid == networkIdJoueur || networkIdJoueur == this.netId)
        {
            CartePlaneteMetier cartePlaneteScript = goScript.GetComponent <CartePlaneteMetier> ();
            this.cartePlanetJoueur = cartePlaneteScript;
            cartePlaneteScript.generateGOCard();
        }

        Debug.Log("End RpcGeneratePlanete");
    }
Esempio n. 4
0
    public static CartePlaneteMetier getPlaneteEnnemie(NetworkInstanceId idJoueur)
    {
        CartePlaneteMetier planeteResult = null;

        CartePlaneteMetier[] listPlanete = GameObject.FindObjectsOfType <CartePlaneteMetier> ();

        if (null != listPlanete && listPlanete.Length > 0)
        {
            foreach (CartePlaneteMetier planete in listPlanete)
            {
                if (planete.idJoueurProprietaire != idJoueur)
                {
                    planeteResult = planete;
                    break;
                }
            }
        }

        return(planeteResult);
    }
Esempio n. 5
0
    public void attaquePlanete(CartePlaneteMetier cible, NetworkInstanceId netIdTaskEvent)
    {
        //TODO
        bool modeFurtif = 0 < CapaciteUtils.valeurAvecCapacite(0, listEffetCapacite, ConstanteIdObjet.ID_CAPACITE_ETAT_FURTIF);

        //Mode furtif permet d'attaquer sans déclancher de réponse
        if (modeFurtif)
        {
            JoueurUtils.getJoueurLocal().CmdCreateTask(cible.netId, JoueurProprietaire.netId, this.IdISelectionnable, ConstanteIdObjet.ID_CONDITION_ACTION_RECOIT_DEGAT, netIdTaskEvent, false);
        }
        else
        {
            JoueurUtils.getJoueurLocal().CmdCreateTask(cible.netId, JoueurProprietaire.netId, this.IdISelectionnable, ConstanteIdObjet.ID_CONDITION_ACTION_DEFEND, netIdTaskEvent, false);
        }
        AttaqueCeTour = true;

        if (!isCapableAttaquer())
        {
            this.JoueurProprietaire.CarteSelectionne = null;
        }
    }