Пример #1
0
    public void Start()
    {
        Turn            = 1;
        popUpClose      = GameUI.Instance.ClosePopUp;
        popUpClose     += SetPlayable;
        closePopUpTimer = new Timer(2f, popUpClose, false);

        Option.toCall moveHandler = new Option.toCall(Move);
        move = new Option("Move", moveHandler);

        Option.toCall attackHandler = new Option.toCall(Attack);
        attack = new Option("Attack", attackHandler);

        Option.toCall captureHandler = new Option.toCall(Capture);
        capture = new Option("Capture", captureHandler);

        Option.toCall tankHandler = new Option.toCall(MakeTank);
        tank = new Option("Tank", tankHandler);

        Option.toCall infanteryHandler = new Option.toCall(MakeInfantery);
        infantery = new Option("Infantery", infanteryHandler);

        Option.toCall bazookaHandler = new Option.toCall(MakeBazooka);
        bazooka = new Option("Bazooka", bazookaHandler);

        GameUI.Instance.UpdateMoney(moneyPlayer1);
        MapManager.Instance.SetNewTurn(playerOnePhase);
    }
Пример #2
0
    public void Start()
    {
        wrapper        = DeRegister;
        waterDestroyer = new List <Timer>();
        waterRegister  = new List <GameObject>();
        waterSpawners  = new List <GameObject>();

        foreach (GameObject spawner in GameObject.FindGameObjectsWithTag("WaterSpawner"))
        {
            waterSpawners.Add(spawner);
        }
    }
Пример #3
0
    public void LaunchEndGame(bool winner)
    {
        playable = false;

        popUpClose  = GameUI.Instance.ClosePopUp;
        popUpClose -= SetPlayable;
        popUpClose += EndGame;
        closePopUpTimer.ChangeTimeToWait(3f);

        string win        = winner ? "red" : "blue";
        string victoryMSG = string.Format("Player {0}\r\n WIN", win);

        GameUI.Instance.SendPopUp(victoryMSG);
        TimerManager.Instance.AddTimer(this, closePopUpTimer);
    }
Пример #4
0
    /// <summary>
    /// Best way is to init your timer in the start, then add it when you need it
    /// But if you want creat and add in the same time, you can use it
    /// </summary>
    /// <param name="from"> Alwayse "this"</param>
    /// <param name="time"> Explicit </param>
    /// <param name="handler"> What you whant to call at the end of the timer</param>
    /// <param name="timebook">
    /// Choose the timebook :
    /// Global -> Alwayse update
    /// Game -> update only in Game
    /// Menu -> update only in menu
    /// <returns>Timer just created</returns>
    public Timer CreateSimpleTimer(object from, float time, Timer.toCall handler, Timebook timebook = Timebook.Global)
    {
        Timer newOne = new Timer(time, handler);

        Dictionary <object, List <TimeUp> > revelantTimebook = GetRelevantTimebook(timebook);

        if (revelantTimebook.ContainsKey(from))
        {
            revelantTimebook[from].Add(newOne);
        }
        else
        {
            List <TimeUp> list = new List <TimeUp>();
            list.Add(newOne);
            revelantTimebook.Add(from, list);
        }

        return(newOne);
    }
Пример #5
0
    public void Start()
    {
        spawned     = 0;
        shelts      = new List <Shelt>();
        spawn       = GameObject.Find("Spawn");
        MotherShelt = new GameObject();
        MotherShelt.transform.name = "MotherShelt";
        spawnCall         = new Timer.toCall(SpawnWork);
        sheltSpwanerTimer = new Timer(GV.Instance.timeBetwenSheltSpawn, spawnCall, true);
        Shadow            = GameObject.Instantiate(Resources.Load("Prefabs/Shadow") as GameObject);
        Shadow.SetActive(false);

        for (int i = 0; i < GV.Instance.sheltToSpawn; i++)
        {
            Shelt newShelt = new Shelt(spawn.transform.position, $"Shelt-{(1+i).ToString()}", MotherShelt);
            shelts.Add(newShelt);
        }

        TimerManager.Instance.AddTimer(this, sheltSpwanerTimer, TimerManager.Timebook.InGame);
        SpawnWork();
    }
Пример #6
0
 // Use this for initialization
 public void Start()
 {
     delayerHandler = StopDelayer;
     delayer        = new Timer(.2f, delayerHandler, false);
 }