Ejemplo n.º 1
0
 public void shootViewProjectile(byte[] ProjectileBytes)
 {
     try {
         ProjectileData projData = ProjectileData.deserialize(ProjectileBytes);
         projData.startTime = getTime();
         if (projData.hitTime < projData.startTime + 100)   // Min take 100ms to hit.
         {
             projData.hitTime = projData.startTime + 100;
         }
         projData.isView = true;
         PlayerGameState oppGameState = getOpponentGameState();
         Monster         target       = oppGameState.monsterRef[projData.targetSerializeId];
         Vector2         source       = oppGameState.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 (oppGameState.sendMapData)
         {
             SoundManager.instance.PlayShoot(TowerR.getById(projData.towerId).shootingSound);
         }
         proj.Initialize();
     } catch (KeyNotFoundException e) {
         Debug.LogWarning(e.StackTrace);
     }
 }