Пример #1
0
    private void SetRender(bool value, GameObject gameObject)
    {
        MiniMapIcon miniMapIcon = gameObject.GetComponentInChildren <MiniMapIcon>();

        if (miniMapIcon != null)
        {
            if (value)
            {
                /*Color color = Color.red;
                 * Player goPlayer = PlayerDatabase.Instance.GetObjectPlayer(gameObject);
                 * for (int i = 0; i < MapObjecsRenderingController.Instance.players.Length; i++)
                 * {
                 *  if (goPlayer == MapObjecsRenderingController.Instance.players[i])
                 *  {
                 *      color = Color.blue;
                 *      break;
                 *  }
                 * }
                 * miniMapIcon.GetComponent<SpriteRenderer>().color = color;*/
                miniMapIcon.GetComponent <SpriteRenderer>().enabled = true;
            }
            else
            {
                miniMapIcon.GetComponent <SpriteRenderer>().enabled = false;
            }
        }
    }
Пример #2
0
 public void RemoveIcon(MiniMapIcon icon)
 {
     if (icon == null || icon.gameObject == null)
     {
         return;
     }
     icons.Remove(icon);
     Destroy(icon.gameObject);
 }
Пример #3
0
    public MiniMapIcon AddStaticIcon(MinimapIconType type, Vector2i tilePos)
    {
        prefab.type = type;
        MiniMapIcon icon = Instantiate(prefab, transform);

        icon.UpdateIcon(tilePos);
        icons.Add(icon);
        return(icon);
    }
Пример #4
0
 public void Attach(MonoBehaviour root_object)
 {
     //IL_000d: Unknown result type (might be due to invalid IL or missing references)
     //IL_0012: Expected O, but got Unknown
     if (!(root_object is Self))
     {
         Transform val = root_object.get_transform();
         int       i   = 0;
         for (int count = icons.Count; i < count; i++)
         {
             if (icons[i].target == val)
             {
                 return;
             }
         }
         string      text        = string.Empty;
         int         num         = -1;
         MiniMapIcon miniMapIcon = null;
         if (root_object is PortalObject)
         {
             num = 0;
         }
         else if (root_object is Player)
         {
             Player player = root_object as Player;
             if (!player.isInitialized)
             {
                 return;
             }
             num = 1;
             if (playerIconStock.Count > 0)
             {
                 miniMapIcon = playerIconStock[0];
                 playerIconStock.Remove(miniMapIcon);
             }
         }
         else if (root_object is Enemy)
         {
             if (!GameSaveData.instance.enableMinimapEnemy && !QuestManager.IsValidInGameWaveMatch())
             {
                 return;
             }
             Enemy enemy = root_object as Enemy;
             if (!enemy.isInitialized)
             {
                 return;
             }
             num = 2;
             if (enemyIconStock.Count > 0)
             {
                 miniMapIcon = enemyIconStock[0];
                 enemyIconStock.Remove(miniMapIcon);
             }
         }
         else if (root_object is FieldWaveTargetObject)
         {
             FieldWaveTargetObject fieldWaveTargetObject = root_object as FieldWaveTargetObject;
             if (!fieldWaveTargetObject.isInitialized)
             {
                 return;
             }
             num = 3;
             if (waveTargetIconStock.Count > 0)
             {
                 miniMapIcon = waveTargetIconStock[0];
                 waveTargetIconStock.Remove(miniMapIcon);
             }
             text = "dp_radar_" + fieldWaveTargetObject.info.iconName;
         }
         if (miniMapIcon == null && num >= 0 && num < iconPrefabs.Length)
         {
             GameObject val2 = ResourceUtility.Instantiate <GameObject>(iconPrefabs[num]);
             if (val2 != null)
             {
                 miniMapIcon = val2.GetComponent <MiniMapIcon>();
             }
         }
         if (miniMapIcon != null)
         {
             miniMapIcon.Initialize(root_object);
             if (!text.IsNullOrWhiteSpace())
             {
                 miniMapIcon.SetIconSprite(text);
             }
             miniMapIcon.target = val;
             Utility.Attach(iconRoot, miniMapIcon._trasform);
             icons.Add(miniMapIcon);
             updateCount = 0;
         }
     }
 }
Пример #5
0
    // Generates quest items
    public void GenerateQuestItems()
    {
        // Assign the exit cube position
        int xPos    = 0;
        int zPos    = 0;
        int xPosTwo = 0;
        int zPosTwo = 0;

        // Choose the exit side
        int exitSide = Random.Range(0, 4);

        // Switch on exit side and assign random exit cube
        switch (exitSide)
        {
        // Left side
        case 0:
            xPos    = 1;
            xPosTwo = 0;
            zPos    = Random.Range(2, map.GridHeight() - 3);
            zPosTwo = zPos;
            break;

        // Top side
        case 1:
            xPos    = Random.Range(2, map.GridWidth() - 3);
            xPosTwo = xPos;
            zPos    = map.GridHeight() - 2;
            zPosTwo = map.GridHeight() - 1;
            break;

        // Right side
        case 2:
            xPos    = map.GridWidth() - 2;
            xPosTwo = map.GridWidth() - 1;
            zPos    = Random.Range(2, map.GridHeight() - 3);
            zPosTwo = zPos;
            break;

        // Bottom side
        case 3:
            xPos    = Random.Range(2, map.GridWidth() - 3);
            xPosTwo = xPos;
            zPos    = 1;
            zPosTwo = 0;
            break;
        }

        // Set the exit cube as a tigger and disable the mesh renderer
        GameObject exit = map.GridCubeArray()[xPos, zPos];

        exit.GetComponent <BoxCollider>().isTrigger = true;
        exit.GetComponent <MeshRenderer>().enabled  = false;
        exit.GetComponent <CubeData>().SetCubeType(CUBETYPE.EXIT);
        GameObject light = Object.Instantiate(exitLight, exit.transform.position, Quaternion.identity, exit.transform);

        light.SetActive(true);

        exit = map.GridCubeArray()[xPosTwo, zPosTwo];
        exit.GetComponent <BoxCollider>().isTrigger = true;
        exit.GetComponent <MeshRenderer>().enabled  = false;
        exit.GetComponent <CubeData>().SetCubeType(CUBETYPE.EXIT);
        light = Object.Instantiate(exitLight, exit.transform.position, Quaternion.identity, exit.transform);
        light.SetActive(true);

        // Add exit to the minimap
        miniMapIcon = exit.AddComponent <MiniMapIcon>();
        miniMapIcon.miniMapImage = questManager.exitImage;
    }