Exemplo n.º 1
0
        private void CmdSpawnUnit()
        {
            if (queuedUnits == maxUnitQueue)
            {
                return;
            }
            rtsPlayer = connectionToClient.identity.GetComponent <RtsPlayer>();
            int resources = rtsPlayer.GetResources();

            if (resources < unitPrefab.GetResourceCost())
            {
                return;
            }
            queuedUnits++;
            rtsPlayer.SetResources(rtsPlayer.GetResources() - unitPrefab.GetResourceCost());
        }
 private void Update()
 {
     timer -= Time.deltaTime;
     if (timer > 0)
     {
         return;
     }
     timer = interval;
     rtsPlayer.SetResources(rtsPlayer.GetResources() + resourcesPerInterval);
 }
Exemplo n.º 3
0
 public void OnPointerDown(PointerEventData eventData)
 {
     if (eventData.button != PointerEventData.InputButton.Left)
     {
         return;
     }
     if (rtsPlayer.GetResources() < building.GetPrice())
     {
         return;
     }
     buildingPreviewInstance  = Instantiate(building.GetBuildingPreview());
     buildingRendererInstance = buildingPreviewInstance.GetComponentInChildren <Renderer>();
     buildingPreviewInstance.SetActive(false);
 }
Exemplo n.º 4
0
 private void Update()
 {
     if (rtsPlayer)
     {
         return;
     }
     rtsPlayer = NetworkClient.connection.identity.GetComponent <RtsPlayer>();
     if (!rtsPlayer)
     {
         return;
     }
     ClientHandleResourcesUpdated(rtsPlayer.GetResources());
     rtsPlayer.ClientOnResourcesUpdated += ClientHandleResourcesUpdated;
 }