Ejemplo n.º 1
0
 public void shootProjectile(ProjectileData projData)
 {
     try {
         PlayerGameState ownGameState = getOwnGameState();
         Monster         target       = ownGameState.monsterRef[projData.targetSerializeId];
         Vector2         source       = ownGameState.viewMapRef.getTile(projData.startCoord.row, projData.startCoord.col).transform.position;
         Projectile      proj         = projectilePool.GetProjectile();
         proj.projData       = projData;
         proj.target         = target;
         proj.source         = source;
         proj.spriteR.sprite = TowerR.getById(projData.towerId).projectileSprite;
         proj.splashR.color  = TowerR.getById(projData.towerId).splashColor;
         if (!getOpponentGameState().sendMapData)
         {
             SoundManager.instance.PlayShoot(TowerR.getById(projData.towerId).shootingSound);
         }
         proj.Initialize();
         if (getOwnGameState().sendMapData&& PhotonNetwork.connected)
         {
             photonView.RPC("shootViewProjectile", PhotonTargets.Others, projData.serialize());
         }
     } catch (KeyNotFoundException e) {
         Debug.LogWarning(e.StackTrace);
     }
 }