private void Update()
 {
     timer -= Time.deltaTime;
     if (timer <= 0)
     {
         timer += interval;
         player.ModifyResources(resourcesPerInterval);
     }
 }
Beispiel #2
0
    private void CmdSpawnUnit()
    {
        if (queuedUnits == maxUnitQueue)
        {
            return;
        }

        RTSPlayer player = connectionToClient.identity.GetComponent <RTSPlayer>();

        if (player.GetResources() < unitPrefab.GetResourceCost())
        {
            return;
        }

        queuedUnits++;

        player.ModifyResources(-unitPrefab.GetResourceCost());
    }