Exemplo n.º 1
0
    public void InitGridController(int xPlayer, int yPlayer, Vector3 centerplayer1, 
	                                Vector3 centerPlayer2, GameObject spawnMobPlayer1, 
	                                GameObject spawnMobPlayer2, Player_Board.e_player player)
    {
        createGrah (ggPlayer1, xPlayer * 2 + 5, yPlayer * 2 + 5, centerplayer1);
        createGrah (ggPlayer2, xPlayer * 2 + 5, yPlayer * 2 + 5, centerPlayer2);
    }
Exemplo n.º 2
0
 public void StartCounters()
 {
     playerBoard = menu.getMyPlayerObject().GetComponent<Player_Board> ();
     textTimeGame.text = "";
     incomeTime = timeToIncome;
     start = end = DateTime.Now;
     isStarted = true;
 }
Exemplo n.º 3
0
 public void upgrade(Player_Board.e_color newColor)
 {
     if (newColor != Player_Board.e_color.NONE)
         color = newColor;
     else
         ++level;
     if (script == null)
         script = GameObject.Find("Board").GetComponent<Upgrade>();
     setNewStats(script.getNewStats(type, color, level));
 }
Exemplo n.º 4
0
 public void WannaCreateMob(MonstersSelection.e_enemy mob, Player_Board.e_player player)
 {
     int money;
     UpgradeMonsters.Stats monsterInfo = GameObject.Find ("Board").GetComponent<UpgradeMonsters> ().getNewStats (mob, 1);
     money = GameObject.Find ("PlayerNetID : 1").GetComponent<Player_Board> ().money;
     Debug.Log ("money = " + money);
     Debug.Log ("cost = " + monsterInfo.cost);
     if (monsterInfo.cost <= money) {
         CmdCreateMob (mob, player);
     }
 }
Exemplo n.º 5
0
 void RpcCreateMob(MonstersSelection.e_enemy mob, Player_Board.e_player player)
 {
     if (enemySpawn == null || myForceSpawn == null){
         Player_Board.e_player playerTeam = GetComponent<Player_ID> ().playerTeam;
         enemySpawn = GameObject.Find(playerTeam.ToString() + "-MOBSPAWN");
         if (playerTeam == Player_Board.e_player.PLAYER1){
             myForceSpawn = GameObject.Find(Player_Board.e_player.PLAYER2.ToString() + "-MOBSPAWN");
         }
         else{
             myForceSpawn = GameObject.Find(Player_Board.e_player.PLAYER1.ToString() + "-MOBSPAWN");
         }
     }
     Vector3 PopPosition = new Vector3 ();
     if (player == GetComponent<Player_ID> ().playerTeam) {
         PopPosition = myForceSpawn.transform.position;
     }
     else {
         PopPosition = enemySpawn.transform.position;
     }
     UpgradeMonsters.Stats monsterInfo = GameObject.Find ("Board").GetComponent<UpgradeMonsters> ().getNewStats (mob, 1);
     GameObject mobGO = new GameObject();
     switch (mob) {
     case MonstersSelection.e_enemy.MONSTER1:
         mobGO = Instantiate(monster1, PopPosition , Quaternion.identity) as GameObject;
         break;
     case MonstersSelection.e_enemy.MONSTER2:
         mobGO = Instantiate(monster2, PopPosition , Quaternion.identity) as GameObject;
         break;
     case MonstersSelection.e_enemy.MONSTER3:
         mobGO = Instantiate(monster3, PopPosition , Quaternion.identity) as GameObject;
         break;
     case MonstersSelection.e_enemy.MONSTER4:
         mobGO = Instantiate(monster4, PopPosition , Quaternion.identity) as GameObject;
         break;
     case MonstersSelection.e_enemy.MONSTER5:
         mobGO = Instantiate(monster5, PopPosition , Quaternion.identity) as GameObject;
         break;
     case MonstersSelection.e_enemy.MONSTER6:
         mobGO = Instantiate(monster6, PopPosition , Quaternion.identity) as GameObject;
         break;
     case MonstersSelection.e_enemy.MONSTER7:
         mobGO = Instantiate(monster7, PopPosition , Quaternion.identity) as GameObject;
         break;
     case MonstersSelection.e_enemy.MONSTER8:
         mobGO = Instantiate(monster8, PopPosition , Quaternion.identity) as GameObject;
         break;
     case MonstersSelection.e_enemy.MONSTER9:
         mobGO = Instantiate(monster9, PopPosition , Quaternion.identity) as GameObject;
         break;
     }
     mobGO.GetComponent<Monster> ().setPlayerBoard (GetComponent<Player_ID> ().playerTeam);
     mobGO.GetComponent<Monster> ().upgrade (1);
     GameObject.Find ("PlayerNetID : 1").GetComponent<Player_Board> ().money -= monsterInfo.cost;
 }
Exemplo n.º 6
0
 public bool isTowerPutable(GameObject obj, Player_Board.e_player playerPlaying)
 {
     Transform spawn;
     Transform nexus;
     if (playerPlaying == Player_Board.e_player.PLAYER1) {
         spawn = GameObject.Find ("PLAYER1-MOBSPAWN").transform;
         nexus = GameObject.Find ("PLAYER1-NEXUS").transform;
     } else {
         spawn = GameObject.Find ("PLAYER2-MOBSPAWN").transform;
         nexus = GameObject.Find ("PLAYER2-NEXUS").transform;
     }
     GraphUpdateObject guo = new GraphUpdateObject (obj.GetComponent<Collider> ().bounds);
     GraphNode spawnNode = AstarPath.active.GetNearest (spawn.position).node;
     GraphNode nexusNode = AstarPath.active.GetNearest (nexus.position).node;
     if (GraphUpdateUtilities.UpdateGraphsNoBlock (guo, spawnNode, nexusNode, false)) {
         Debug.Log ("Tower is putable");
         return true;
     } else {
         Debug.Log ("Tower is NOT putable !!");
         return false;
     }
 }
Exemplo n.º 7
0
 //fonction appellée pour donner les nouvelles specs de la case à cette tour
 public void UpdateInfos(Player_Board.t_infoSlot newInfos)
 {
     type = newInfos.tower;
     level = newInfos.level;
     color = newInfos.color;
 }
Exemplo n.º 8
0
 public void InitInterfaces(Player_Board.e_player player, GameObject thePlayerObject)
 {
     playerTeam = player;
     PlayerObject = thePlayerObject;
     changeMenuMode (e_InterfaceMode.IN_GAME);
 }
Exemplo n.º 9
0
 public void setPlayerBoard(Player_Board.e_player p)
 {
     m_player = p;
 }
Exemplo n.º 10
0
 void CmdCreateMob(MonstersSelection.e_enemy mob, Player_Board.e_player player)
 {
     RpcCreateMob (mob, player);
 }
Exemplo n.º 11
0
    public TurretInfos standardTower(Player_Board.e_color color, int level)
    {
        TurretInfos turretInfos;

        switch (color)
        {
            case Player_Board.e_color.BLUE:
            {
                switch (level)
                {
                        case 1:
                            turretInfos.damage = damage * 1.1;
                            turretInfos.cost = cost * 2;
                            return (turretInfos);
                        case 2:
                            turretInfos.damage = damage * 1.2;
                            turretInfos.cost = cost * 4;
                            return (turretInfos);
                        case 3:
                            turretInfos.cost = cost * 8;
                            turretInfos.damage = damage * 1.3;
                            return (turretInfos);
                        case 4:
                            turretInfos.damage = damage * 1.4;
                            turretInfos.cost = cost * 16;
                            return (turretInfos);
                        case 5:
                            turretInfos.damage = damage * 1.5;
                            turretInfos.cost = cost * 32;
                            return (turretInfos);
                }
                break;
            }
            case Player_Board.e_color.GREEN:
                {
                    switch (level)
                    {
                        case 1:
                            turretInfos.damage = damage;
                            turretInfos.cost = cost * 2;
                            return (turretInfos);
                        case 2:
                            turretInfos.damage = damage;
                            turretInfos.cost = cost * 4;
                            return (turretInfos);
                        case 3:
                            turretInfos.cost = cost * 8;
                            turretInfos.damage = damage;
                            return (turretInfos);
                        case 4:
                            turretInfos.damage = damage;
                            turretInfos.cost = cost * 16;
                            return (turretInfos);
                        case 5:
                            turretInfos.damage = damage;
                            turretInfos.cost = cost * 32;
                            return (turretInfos);
                    }
                    break;
                }
            case Player_Board.e_color.RED:
                {
                    switch (level)
                    {
                        case 1:
                            turretInfos.damage = damage * 1.25;
                            turretInfos.cost = cost * 2;
                            return (turretInfos);
                        case 2:
                            turretInfos.damage = damage * 1.5;
                            turretInfos.cost = cost * 4;
                            return (turretInfos);
                        case 3:
                            turretInfos.damage = damage * 1.75;
                            turretInfos.cost = cost * 8;
                            return (turretInfos);
                        case 4:
                            turretInfos.damage = damage * 2;
                            turretInfos.cost = cost * 16;
                            return (turretInfos);
                        case 5:
                            turretInfos.damage = damage * 3;
                            turretInfos.cost = cost * 32;
                            return (turretInfos);
                    }
                    break;
                }
        }
        Debug.Log ("damage VERIF 1 = " + damage);
        turretInfos.damage = damage;
        Debug.Log ("damage VERIF 2 = " + damage);
        turretInfos.cost = cost;
        return (turretInfos);
    }
Exemplo n.º 12
0
    public TurretInfos sniperTower(Player_Board.e_color color, int level)
    {
        TurretInfos turretInfos;

        switch (color)
        {
            case Player_Board.e_color.BLUE:
                {
                    switch (level)
                    {
                        case 1:
                            turretInfos.damage = damage * 2.1;
                            turretInfos.cost = cost * 8;
                            return (turretInfos);
                        case 2:
                            turretInfos.damage = damage * 2.2;
                            turretInfos.cost = cost * 16;
                            return (turretInfos);
                        case 3:
                            turretInfos.damage = damage * 2.3;
                            turretInfos.cost = cost * 28;
                            return (turretInfos);
                        case 4:
                            turretInfos.damage = damage * 2.4;
                            turretInfos.cost = cost * 40;
                            return (turretInfos);
                        case 5:
                            turretInfos.damage = damage * 2.5;
                            turretInfos.cost = cost * 60;
                            return (turretInfos);
                    }
                    break;
                }
            case Player_Board.e_color.GREEN:
                {
                    switch (level)
                    {
                        case 1:
                            turretInfos.damage = damage;
                            turretInfos.cost = cost * 8;
                            return (turretInfos);
                        case 2:
                            turretInfos.damage = damage;
                            turretInfos.cost = cost * 16;
                            return (turretInfos);
                        case 3:
                            turretInfos.cost = cost * 28;
                            turretInfos.damage = damage;
                            return (turretInfos);
                        case 4:
                            turretInfos.damage = damage;
                            turretInfos.cost = cost * 40;
                            return (turretInfos);
                        case 5:
                            turretInfos.damage = damage;
                            turretInfos.cost = cost * 60;
                            return (turretInfos);
                    }
                    break;
                }
            case Player_Board.e_color.RED:
                {
                    switch (level)
                    {
                        case 1:
                            turretInfos.damage = damage * 2.25;
                            turretInfos.cost = cost * 8;
                            return (turretInfos);
                        case 2:
                            turretInfos.damage = damage * 2.5;
                            turretInfos.cost = cost * 16;
                            return (turretInfos);
                        case 3:
                            turretInfos.damage = damage * 2.75;
                            turretInfos.cost = cost * 28;
                            return (turretInfos);
                        case 4:
                            turretInfos.damage = damage * 3;
                            turretInfos.cost = cost * 40;
                            return (turretInfos);
                        case 5:
                            turretInfos.damage = damage * 4;
                            turretInfos.cost = cost * 60;
                            return (turretInfos);
                    }
                    break;
                }
        }

        turretInfos.damage = damage * 2;
        turretInfos.cost = cost * 4;
        return (turretInfos);
    }
Exemplo n.º 13
0
    public TurretInfos getNewStats(Player_Board.e_tower type, Player_Board.e_color color, int level)
    {
        TurretInfos turretInfos;

        switch (type)
        {
            case Player_Board.e_tower.STANDARD:
                turretInfos = standardTower(color, level);
                break;
            case Player_Board.e_tower.ANTIAIR:
                turretInfos = antiaerialTower(color, level);
                break;
            case Player_Board.e_tower.GATLING:
                turretInfos = gatlingTower(color, level);
                break;
            case Player_Board.e_tower.MELEE:
                turretInfos = meleeTower(color, level);
                break;
            case Player_Board.e_tower.SNIPER:
                turretInfos = sniperTower(color, level);
                break;
            case Player_Board.e_tower.SPLASH:
                turretInfos = mortarTower(color, level);
                break;
            default:
                turretInfos.damage = damage;
                turretInfos.cost = cost;
                break;
        }
        Debug.Log ("turretInfos damage VERIF = " + turretInfos.damage);
        return (turretInfos);
    }
Exemplo n.º 14
0
    public TurretInfos gatlingTower(Player_Board.e_color color, int level)
    {
        TurretInfos turretInfos;

        switch (color)
        {
            case Player_Board.e_color.BLUE:
                {
                    switch (level)
                    {
                        case 1:
                            turretInfos.damage = damage * 0.45;
                            turretInfos.cost = cost * 6;
                            return (turretInfos);
                        case 2:
                            turretInfos.damage = damage * 0.5;
                            turretInfos.cost = cost * 12;
                            return (turretInfos);
                        case 3:
                            turretInfos.damage = damage * 0.55;
                            turretInfos.cost = cost * 24;
                            return (turretInfos);
                        case 4:
                            turretInfos.damage = damage * 0.6;
                            turretInfos.cost = cost * 36;
                            return (turretInfos);
                        case 5:
                            turretInfos.damage = damage * 0.65;
                            turretInfos.cost = cost * 50;
                            return (turretInfos);
                    }
                    break;
                }
            case Player_Board.e_color.GREEN:
                {
                    switch (level)
                    {
                        case 1:
                            turretInfos.damage = damage;
                            turretInfos.cost = cost * 6;
                            return (turretInfos);
                        case 2:
                            turretInfos.damage = damage;
                            turretInfos.cost = cost * 12;
                            return (turretInfos);
                        case 3:
                            turretInfos.cost = cost * 24;
                            turretInfos.damage = damage;
                            return (turretInfos);
                        case 4:
                            turretInfos.damage = damage;
                            turretInfos.cost = cost * 36;
                            return (turretInfos);
                        case 5:
                            turretInfos.damage = damage;
                            turretInfos.cost = cost * 50;
                            return (turretInfos);
                    }
                    break;
                }
            case Player_Board.e_color.RED:
                {
                    switch (level)
                    {
                        case 1:
                            turretInfos.damage = damage * 0.55;
                            turretInfos.cost = cost * 6;
                            return (turretInfos);
                        case 2:
                            turretInfos.damage = damage * 0.7;
                            turretInfos.cost = cost * 12;
                            return (turretInfos);
                        case 3:
                            turretInfos.damage = damage * 0.85;
                            turretInfos.cost = cost * 24;
                            return (turretInfos);
                        case 4:
                            turretInfos.damage = damage * 1;
                            turretInfos.cost = cost * 36;
                            return (turretInfos);
                        case 5:
                            turretInfos.damage = damage * 1.25;
                            turretInfos.cost = cost * 50;
                            return (turretInfos);
                    }
                    break;
                }
        }

        turretInfos.damage = damage * 0.4;
        turretInfos.cost = cost * 3;
        return (turretInfos);
    }