コード例 #1
0
 // Use this for initialization
 void Start()
 {
     canvasHud = GameObject.Find("CanvasHUD").GetComponentInChildren<CanvasHUDManager>();
     countdownDisplay = GameObject.Find("tbxNextWave").GetComponent<Text>();
     gameDifficulty = GameController.instance.difficulty();
     switch (gameDifficulty) {
     case 0:
         numberToSpawn = 3;
         spawnIncreaseRate = 6;
         timeBeforeFirstWave = 5f;
         timeBetweenWaves = 10f;
         break;
     case 1:
         spawnIncreaseRate = 6;
         timeBeforeFirstWave = 240f;
         timeBetweenWaves = 60f;
         break;
     case 2:
         spawnIncreaseRate = 5;
         timeBeforeFirstWave = 180f;
         timeBetweenWaves = 55f;
         break;
     case 3:
         spawnIncreaseRate = 4;
         timeBeforeFirstWave = 120f;
         timeBetweenWaves = 50f;
         break;
     case 4:
         spawnIncreaseRate = 4;
         timeBeforeFirstWave = 90f;
         timeBetweenWaves = 45f;
         break;
     default:
         this.enabled = false;
         break;
     }
     timeLeft = timeBeforeFirstWave;
 }
コード例 #2
0
ファイル: Player.cs プロジェクト: sentonnes/RTS-Framework
 void Awake()
 {
     resources = InitResourceList();
     resourceLimits = InitResourceLimitList();
     SelectedObjects = new WorldObject[12];
     Heroes = new WorldObject[3];
     if (human) {
         canvasHud = GameObject.Find("CanvasHUD").GetComponentInChildren<CanvasHUDManager>();
         canvasHud.SetPlayer(this);
     }
 }
コード例 #3
0
 void OnLevelWasLoaded(int level)
 {
     if (initialised)
         switch (level) {
         case 0: //FlashScreen
             //Debug.Log("Flash!");
             break;
         case 1: //MainMenu
             break;
         case 2: //Tutorial Level
             break;
         case 3: //ClosingScreen
             break;
         case 4: //Survival Level
             canvasHud = GameObject.Find("CanvasHUD").GetComponentInChildren<CanvasHUDManager>();
             LoadDetails();
             break;
         default:
             break;
         }
 }
コード例 #4
0
ファイル: Building.cs プロジェクト: sentonnes/RTS-Framework
 public void setHUDSelected(GameObject[] viewedSelection, CanvasHUDManager canvasHUD)
 {
     int button = 0;
     string[] productionList = buildQueue.ToArray();
     foreach (string product in productionList) {
         viewedSelection[button].GetComponent<Image>().color = new Color(255, 255, 255, 255);
         Sprite productImage = ResourceManager.GetBuildImage(product);
         if (productImage == null) foreach (Action action in actions) if (action.getName == product) productImage = action.getSprite;
         viewedSelection[button++].GetComponent<Image>().sprite = productImage;
     }
 }
コード例 #5
0
ファイル: Building.cs プロジェクト: sentonnes/RTS-Framework
 public void setHUDActions(GameObject[] actionButtons, CanvasHUDManager canvasHUD)
 {
     for (int i = 0; i < actions.Length; i++) {
         if (actions[i].getName == null) continue;
         switch (i) {
         case 0:
             actionButtons[0].GetComponent<Button>().onClick.AddListener(delegate {PerformAction(actions[0].getName);});
             actionButtons[0].GetComponent<Image>().color = new Color(255, 255, 255, 255);
             if (actions[0].getEnabled == false) actionButtons[0].GetComponent<Button>().interactable = false;
             actionButtons[0].GetComponent<Image>().sprite = actions[0].getSprite;
             break;
         case 1:
             actionButtons[1].GetComponent<Button>().onClick.AddListener(delegate {PerformAction(actions[1].getName);});
             actionButtons[1].GetComponent<Image>().color = new Color(255, 255, 255, 255);
             if (actions[1].getEnabled == false) actionButtons[1].GetComponent<Button>().interactable = false;
             actionButtons[1].GetComponent<Image>().sprite = actions[1].getSprite;
             break;
         case 2:
             actionButtons[2].GetComponent<Button>().onClick.AddListener(delegate {PerformAction(actions[2].getName);});
             actionButtons[2].GetComponent<Image>().color = new Color(255, 255, 255, 255);
             if (actions[2].getEnabled == false) actionButtons[2].GetComponent<Button>().interactable = false;
             actionButtons[2].GetComponent<Image>().sprite = actions[2].getSprite;
             break;
         case 3:
             actionButtons[3].GetComponent<Button>().onClick.AddListener(delegate {PerformAction(actions[3].getName);});
             actionButtons[3].GetComponent<Image>().color = new Color(255, 255, 255, 255);
             if (actions[3].getEnabled == false) actionButtons[3].GetComponent<Button>().interactable = false;
             actionButtons[3].GetComponent<Image>().sprite = actions[3].getSprite;
             break;
         case 4:
             actionButtons[4].GetComponent<Button>().onClick.AddListener(delegate {PerformAction(actions[4].getName);});
             actionButtons[4].GetComponent<Image>().color = new Color(255, 255, 255, 255);
             if (actions[4].getEnabled == false) actionButtons[4].GetComponent<Button>().interactable = false;
             actionButtons[4].GetComponent<Image>().sprite = actions[4].getSprite;
             break;
         case 5:
             actionButtons[5].GetComponent<Button>().onClick.AddListener(delegate {PerformAction(actions[5].getName);});
             actionButtons[5].GetComponent<Image>().color = new Color(255, 255, 255, 255);
             if (actions[5].getEnabled == false) actionButtons[5].GetComponent<Button>().interactable = false;
             actionButtons[5].GetComponent<Image>().sprite = actions[5].getSprite;
             break;
         case 6:
             actionButtons[6].GetComponent<Button>().onClick.AddListener(delegate {PerformAction(actions[6].getName);});
             actionButtons[6].GetComponent<Image>().color = new Color(255, 255, 255, 255);
             if (actions[6].getEnabled == false) actionButtons[6].GetComponent<Button>().interactable = false;
             actionButtons[6].GetComponent<Image>().sprite = actions[6].getSprite;
             break;
         case 7:
             actionButtons[7].GetComponent<Button>().onClick.AddListener(delegate {canvasHUD.setRallyPointCursor();});
             actionButtons[7].GetComponent<Image>().color = new Color(255, 255, 255, 255);
             if (actions[7].getEnabled == false) actionButtons[7].GetComponent<Button>().interactable = false;
             actionButtons[7].GetComponent<Image>().sprite = actions[7].getSprite;
             break;
         case 8:
             actionButtons[8].GetComponent<Button>().onClick.AddListener(delegate {Sell();});
             actionButtons[8].GetComponent<Image>().color = new Color(255, 255, 255, 255);
             if (actions[8].getEnabled == false) actionButtons[8].GetComponent<Button>().interactable = false;
             actionButtons[8].GetComponent<Image>().sprite = actions[8].getSprite;
             break;
         default:
             break;
         }
     }
 }