Example #1
0
    private void MovePositionObjectDraggedToMap()
    {
        Map_manager map = GetComponent <Map_manager>();

        if (Input.GetMouseButtonUp(0))
        {
            if ((_ObjectDragged != null) && (map.CurrentMap != null))
            {
                int num_positions = map.CurrentMap.GetComponent <District>().CurrentPosition;
                //checkear si puedes aƱadir tropas
                if (num_positions < map.CurrentMap.GetComponent <District>().MaxPutPositions)

                {
                    //colocar tropa
                    _ObjectDragged.transform.position = map.CurrentMap.GetComponent <District>().AttachPositions[num_positions].transform.position;
                    //aumentar numero de tropa
                    _ObjectDragged.tag = "Colocadas";
                    map.CurrentMap.GetComponent <District>().CurrentPosition++;
                    //Identificar agente
                    AgentInfo agentInfo = _ObjectDragged.GetComponent <AgentInfo>();

                    //Aumentar el contador en distrito
                    map.CurrentMap.GetComponent <District>().incrementAgent(agentInfo);


                    DataDistrict Ddistrict = GameMngr.Instance.GetDataDistric()[map.CurrentMap.GetComponent <District>().IdDistrict];
                    Ddistrict.hacker   = map.CurrentMap.GetComponent <District>().HackerCount;
                    Ddistrict.spy      = map.CurrentMap.GetComponent <District>().SpyCount;
                    Ddistrict.speecher = map.CurrentMap.GetComponent <District>().SpeecherCount;
                    //GameMngr.Instance.setDataDistrict(map.CurrentMap.GetComponent<District>().IdDistrict, new DataDistrict();

                    DataDistrict Dddistrict = GameMngr.Instance.GetDataDistric()[map.CurrentMap.GetComponent <District>().IdDistrict];

                    Debug.Log("numero de agentes: " + GameMngr.Instance.GetDataDistric()[map.CurrentMap.GetComponent <District>().IdDistrict]);

                    GameMngr.Instance.MaxTroops--;
                }
                else
                {
                    _ObjectDragged.SetActive(false);
                    //GameMngr.Instance.MaxTroops++;
                }

                //TODO: destruir tropa
            }
        }
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        MaxPutPositions = 0;
        GameObject gameManager = GameObject.Find("GameManager");

        mapManager    = gameManager.GetComponent <Map_manager>();
        SpeecherCount = 0;
        HackerCount   = 0;
        SpyCount      = 0;

        if (GameMngr.Instance.getAlreadyInitialized())
        {
            influence   = GameMngr.Instance.GetDataDistric()[IdDistrict].Difficult;
            missionType = GameMngr.Instance.GetDataDistric()[IdDistrict].Mission;
        }


        inicializePositions(missionType);
    }