Exemplo n.º 1
0
    IEnumerator HunterAttack(Hunter target)
    {
        ToggleAbilityControl();
        StartCoroutine(blackout.FadeInBlack());
        bool succeeded = false;

        StopTime();
        TakedownGame minigame = TakedownGame.GetRandGame();

        if (minigame == null)
        {
            print("No Game Received!");
            yield break;
        }
        minigame.drone = false;
        minigame.BeginGame();
        while (!minigame.CheckFinished(ref succeeded))
        {
            yield return(new WaitForSecondsRealtime(1));
        }
        Destroy(minigame);
        StartTime();
        ToggleAbilityControl();
        if (succeeded)
        {
            Destroy(target.gameObject);
            StartCoroutine(blackout.FadeOutBlack());
        }
        else
        {
            foodCollected = 0;
            StartCoroutine(blackout.FadeInBlack());
            SceneManager.LoadSceneAsync(StateSaver.gameState.curArea.name);
        }
    }
Exemplo n.º 2
0
    public static TakedownGame GetRandGame()
    {
        TakedownGame TdownGame = null;

        canvas = GameObject.Find("Canvas");
        int l = (int)StateSaver.Minigames.num_opts;
        int r = Random.Range(1, l);

        StateSaver.Minigames cur = (StateSaver.Minigames)r;
        switch (cur)
        {
        case StateSaver.Minigames.PatternSquares:
            TdownGame = ((GameObject)Instantiate(Resources.Load("Prefabs/Games/PatternSquaresPrefab"))).GetComponent <PatternSquares> ();
            break;

        case StateSaver.Minigames.ShivToTheBeat:
            TdownGame = ((GameObject)Instantiate(Resources.Load("Prefabs/Games/Shiv/ShivToTheBeat"))).GetComponent <ShivToTheBeat> ();
            break;
        }
        RectTransform canvasT = canvas.GetComponent <RectTransform> ();

        TdownGame.transform.SetParent(canvas.transform);
        TdownGame.transform.localPosition = Vector3.zero;
        TdownGame.gameObject.GetComponent <RectTransform> ().sizeDelta = new Vector2(canvasT.rect.width, canvasT.rect.height);
        return(TdownGame);
    }
Exemplo n.º 3
0
    IEnumerator PreformTakedown(Drone target)
    {
        ToggleAbilityControl();
        StartCoroutine(blackout.FadeInBlack());
        bool succeeded = false;

        StopTime();
        TakedownGame minigame = TakedownGame.GetRandGame();

        if (minigame == null)
        {
            print("No Game Received!");
            yield break;
        }
        minigame.drone = true;
        minigame.BeginGame();
        while (!minigame.CheckFinished(ref succeeded))
        {
            yield return(new WaitForSecondsRealtime(1));
        }
        if (succeeded)
        {
            Destroy(target.gameObject);
        }
        Destroy(minigame);
        StartTime();
        ToggleAbilityControl();
        StartCoroutine(blackout.FadeOutBlack());
    }