コード例 #1
0
 public override void OnComponentAdded(BaseComponent c)
 {
     if (c is StartGameComponent)
     {
         ShowGame();
         SetupNextRound();
         SetIsPlaying(true);
         GameObject.Destroy(c);
     }
     else if (c is EndGameComponent)
     {
         HideGame();
         GameObject.Destroy(RoundSystem.GetExistingMatch());
         SetIsPlaying(false);
         GameObject.Destroy(c);
     }
     else if (c is MatchComponent)
     {
         this.OnMatch(c.gameObject);
     }
     else if (c is LossComponent)
     {
         this.OnLoss(c.gameObject);
     }
 }
コード例 #2
0
    private void Start()
    {
        if (BaseSelection.BaseSelected == null)
        {
            BaseSelection.BaseSelected = this.gameObject;
        }
        roundSystem              = GameObject.Find("RoundSystem").GetComponent <RoundSystem>();
        roundSystem.OnNextRound += OnNextRound;


        _damagePerUnit = _selectedUnitScript.DamagePerUnit;
        _healthPerUnit = _selectedUnitScript.HealthPerUnit;

        StartCoroutine(SetConnectedBases(this));

        foreach (var battleUnit in battleUnits)
        {
            if (battleUnitsDictionary.ContainsKey(battleUnit))
            {
                continue;
            }
            battleUnitsDictionary.Add(battleUnit, 0);
            print(battleUnit.gameObject.name + " count is " + battleUnitsDictionary[battleUnit]);
        }
    }
コード例 #3
0
    public override void Refresh()
    {
        int    phaseNumber = RoundSystem.Instance()._phase;
        string phaseName   = "";

        switch (phaseNumber)
        {
        case 0:
            phaseName = "Intro";
            break;

        case 1:
            phaseName = "Move";
            break;

        case 2:
            phaseName = "Shoot";
            break;

        case 3:
            phaseName = "Evade";
            break;

        case 4:
            phaseName = "Reward";
            break;
        }

        _phaseNumber.text = phaseNumber.ToString();
        _phaseName.text   = phaseName;
    }
コード例 #4
0
 private void Start()
 {
     Invoke("FindAllBasesOnMap", 0.1f); // to escape a race with map generator
     _roundSystem              = GameObject.FindObjectOfType <RoundSystem>().GetComponent <RoundSystem>();
     _roundSystem.OnNextRound += StartMakeDecisionsForEachBase;
     _battleHandler            = GameObject.FindObjectOfType <BattleHandler>().GetComponent <BattleHandler>();
 }
コード例 #5
0
 void Awake()
 {
     // + Set the pipeManager to an instance of the PipeManager class
     toggleManager = GameObject.Find("Toggles").GetComponent <ToggleManager> ();
     pipeManager   = GameObject.Find("GameManager").GetComponent <PipeManager> ();
     modelManager  = GetComponent <ModelManager> ();
     roundSystem   = GetComponent <RoundSystem> ();
 }
コード例 #6
0
ファイル: KeyboardManager.cs プロジェクト: ballen1/Bubbleneer
    // Use this for initialization
    void Awake()
    {
        toggleManager = GameObject.Find("Toggles").GetComponent <ToggleManager> ();
        sounds        = GameObject.Find("AudioManager").GetComponent <Sounds> ();

        macroManager = GetComponent <MacroManager> ();
        roundManager = GetComponent <RoundSystem> ();
    }
コード例 #7
0
    void Start()
    {
        RestartButton.onClick.AddListener(RestartButtonClick);
        LevelSelectButton.onClick.AddListener(LevelSelectButtonClick);
        ContinueButton.onClick.AddListener(ContinueButtonClick);

        LM = GameObject.FindGameObjectWithTag("LevelManager").GetComponent <LevelManager> ();
        RM = GameObject.FindGameObjectWithTag("GameManager").GetComponent <RoundSystem> ();
    }
コード例 #8
0
 private void Start()
 {
     myBase                        = GetComponentInParent <Base>();
     _tmPro                        = transform.GetComponent <TextMeshPro>();
     roundSystem                   = GameObject.Find("RoundSystem").GetComponent <RoundSystem>();
     roundSystem.OnNextRound      += OnNextRound;
     myBase.OnNumberOfUnitsChange += OnNumberOfUnitsChange;
     Invoke("UpdateNumberOfUnitsUI", 0.1f);
 }
コード例 #9
0
    // Use this for initialization
    void Start()
    {
        toggleGroupInstance = GetComponent <ToggleGroup> ();

        // + Gets all toggles in the toggle group
        toggles = toggleGroupInstance.GetComponentsInChildren <Toggle> ();

        sounds       = GameObject.Find("AudioManager").GetComponent <Sounds> ();
        roundManager = GameObject.Find("GameManager").GetComponent <RoundSystem> ();
    }
コード例 #10
0
    void ScaleZombie()
    {
        RoundSystem system = GameObject.FindObjectOfType <RoundSystem>();

        //maxHealth = 100 * Mathf.Sqrt(system.currentRound);
        maxHealth = 50 * (Mathf.Sqrt(system.currentRound) * 2);
        health    = maxHealth;

        speed = 5f; //temp
    }
コード例 #11
0
 void OnBorn()
 {
     //行计数器加1
     GameGlobal.Get().GameMain.GridSystem.RowCounter[GetPosition().Position.y]++;
     //添加事件
     EventAdd();
     EventManager.Get().EventTrigger(EventTypes.Unit_OnBorn, gameObject);
     //向回合系统列表添加单位
     RoundSystem.Get().AddUnit(this);
 }
コード例 #12
0
    private void Start()
    {
        GameObject GM = GameObject.FindGameObjectWithTag("GameManager");

        nodeManager  = GM.GetComponent <NodeManager> ();
        roundManager = GM.GetComponent <RoundSystem> ();

        //gets the first two lerp points
        startPoint = this.transform;
        endPoint   = nodeManager.pipeArray[(int)pipes[index].x, (int)pipes[index].y, (int)pipes[index].z].pipe.transform.Find("Lerp Point").transform;
    }
コード例 #13
0
ファイル: Bomb.cs プロジェクト: Hellyhoken/GA-Spel-kod
    private void BombPlant()
    {
        RaycastHit hit;

        Physics.Raycast(transform.position, Vector3.down, out hit, Mathf.Infinity, groundMask);
        NetworkServer.Spawn(Instantiate(plantedBomb, hit.point + plantOffset, Quaternion.LookRotation(hit.normal)));
        weaponSelector.currentWeapon = weaponSelector.FindNextWeapon(-1, 1, true);
        weaponSelector.SelectWeapon(weaponSelector.currentWeapon);
        RoundSystem.PlantBomb();
        NetworkServer.Destroy(gameObject);
    }
コード例 #14
0
    // Use this for initialization
    void Start()
    {
        roundDetect = GameObject.FindGameObjectWithTag("GameController").GetComponent <RoundSystem>();        // Referenz auf das Rundensystem
        tooltip     = tooltipObject;
        sizeText    = sizeTextObject;
        visualText  = visualTextObject;
        //Refernz zur Canvas Group
        canvasGroup = gameObject.GetComponent <CanvasGroup> ();

        // Wenn Inventar "gestartet" wird, soll das Layout erstellt werden
        CreateLayout();
    }
コード例 #15
0
    private void Awake()
    {
        if (instance != null)
        {
            Debug.Log("More than one round system on scene");
        }
        else
        {
            instance = this;
        }

        totemsInScene = GameObject.FindGameObjectsWithTag("Totem");
    }
コード例 #16
0
    // Definieren der Funktion OnMouseOver, welche die Funktion open() aufruft, wenn mit links(0) draufgeklickt wird
    // Solange nicht die Drinkphase oder Endphase aktiv ist
    void OnMouseOver()
    {
        // Es darf nicht in das Eventsystem geklickt werden, damit die Clicks nicht durch die UI gehen
        if (!EventSystem.current.IsPointerOverGameObject())
        {
            roundDetect = GameObject.FindGameObjectWithTag("GameController").GetComponent <RoundSystem>();

            if (Input.GetMouseButtonUp(0) && roundDetect.DrinkingPhase == false && roundDetect.EndPhase == false)
            {
                open();
            }
        }
    }
コード例 #17
0
ファイル: GameMain.cs プロジェクト: BATTLEHAWK00/MyFirstGame
 void OnGameInitialize()
 {
     GameObject grid = ResManager.Get().Load<GameObject>("Prefabs/GridSystem/GridSystem");
     grid.transform.SetParent(GameObject.Find("Ground").transform, false);
     GridSystem = grid.GetComponent<GridSystem>();
     GridSystem.enabled = true;
     GridSystem.gameObject.name = "GridSystem";
     HolyWaterSystem.Get().Init();
     RoundSystem.Get().Init(1);
     UIManager.Get();
     UIManager.Get().PushPanel(PanelTypes.HUDPanel);
     //GameNetwork.Getinstance().GetNetWorkManager();
 }
コード例 #18
0
 void Awake()
 {
     if (Instance != null && Instance != this)
     {
         Destroy(gameObject);
     }
     else
     {
         Debug.Log("init");
         Instance = this;
         states   = RoundState.WAITING;
         StartCoroutine(SetupRound());
     }
 }
コード例 #19
0
    /*
     * - Start, set last color and therefore set background
     * - game should exist but all game objects should be inactive
     * - on start, we initialize the game w/ prev color and next color, show game objects
     * - play
     * - on end game, we hide all the things and then turn off the game objects
     * - on restart, we start game again w/ prev color and next color, show game objects
     * - on end total, we hide all the things and then turn off the game objects
     *
     * - tutorial
     * - inherit from roundsystem with tutorialroundsystem, overriding some things
     * - use queue of colors, or hardcode them per level in color chooser function
     */

    public override void Update()
    {
        GameController gc = (Controller() as GameController);

        if (!gc.isPlaying)
        {
            return;
        }
        if (gc.initializeGame)
        {
            gc.initializeGame = false;
            GameObject.Destroy(RoundSystem.GetExistingMatch());
            ClearCubes();
            Reset(gc.round);
        }

        if (GetExistingMatch() != null)
        {
            return;
        }

        List <BaseComponent> matchableComponents = Pool.Instance.ComponentsForType(typeof(MatchableComponent));
        MatchableComponent   target = null;
        bool hasMatch = true;

        foreach (MatchableComponent mac in matchableComponents)
        {
            ColorableComponent cac = mac.GetComponent <ColorableComponent>();

            if (target == null)
            {
                target = mac;
                continue;
            }

            Color targetColor = target.GetComponent <ColorableComponent>().color;
            if (targetColor != cac.color)
            {
                hasMatch = false;
            }
        }

        if (target)
        {
            if (hasMatch)
            {
                BaseObject.AddComponent <MatchComponent>();
            }
        }
    }
コード例 #20
0
    private void Start()
    {
        groundManager = GameObject.Find("GameManager").GetComponent <GroundManager>();

        startPoint  = this.transform;
        nodeManager = GameObject.Find("GameManager").GetComponent <NodeManager>();
        roundSystem = GameObject.Find("GameManager").GetComponent <RoundSystem>();

        arrayPos = nodeManager.worldToArray(this.transform.parent.position + new Vector3(0, 3, 0));
        checkPipe(arrayPos);

        dropValue = Random.Range(dropMin, dropMax);
        x         = Random.Range(1.0f, 5.0f);
    }
コード例 #21
0
    // Funktion, die oben definiertes Panel schliesst und dabei wieder einfadet und eine Runde weiter geht
    public void close()
    {
        nextRound       = GameObject.FindGameObjectWithTag("GameController").GetComponent <RoundSystem>();
        nextRoundFadeIn = GameObject.FindGameObjectWithTag("GameController").GetComponent <ScreenFader>();

        // Die Endphase vom Roundsystem wird auf false gesetzt. Die Kaufphase beginnt also wiede
        nextRound.EndPhase = false;
        // Die Rundenzahl wird um 1 erhoeht
        nextRound.currentRound++;
        // Das Panel wird inaktiv gesetzt
        thePanel.SetActive(false);

        // Das FadeIn wird initialisiert
        nextRoundFadeIn.BeginFade(-1);
    }
コード例 #22
0
    // Use this for initialization
    void Awake()
    {
        pipeManager = GameObject.Find("GameManager").GetComponent <PipeManager> ();
        highLight   = GameObject.Find("GameManager").GetComponent <Highlight> ();
        toolManager = GameObject.Find("GameManager").GetComponent <ToolManager> ();

        modelManager  = GetComponent <ModelManager> ();
        roundManager  = GetComponent <RoundSystem> ();
        nodeManager   = GetComponent <NodeManager> ();
        groundManager = GetComponent <GroundManager>();
        toggleManager = GameObject.Find("Toggles").GetComponent <ToggleManager> ();

        sounds = GameObject.Find("AudioManager").GetComponent <Sounds> ();

        Bank = GetComponent <CashManager> ();
    }
コード例 #23
0
    void NextRound(object info)
    {
        if (text == null)
        {
            text = GetComponentInChildren <UnityEngine.UI.Text>();
        }
        uint round = RoundSystem.Get().Rounds;

        if (round % 2 == RoundSystem.Get().Side)
        {
            text.text = "回合数:" + RoundSystem.Get().Rounds.ToString() + "(你的回合)";
        }
        else
        {
            text.text = "回合数:" + RoundSystem.Get().Rounds.ToString();
        }
    }
コード例 #24
0
 void OnDeath()
 {
     //播放死亡音效
     AudioManager.Get().PlaySound(SoundsList.Unit_OnDeath, 0.2f);
     //广播死亡消息
     UIManager.Get().MsgOnScreen(UnitName + "已死亡!");
     //行计数器扣除
     GameGlobal.Get().GameMain.GridSystem.RowCounter[GetPosition().Position.y]--;
     //触发单位死亡事件(Unit_OnUnitDeath)
     EventManager.Get().EventTrigger(EventTypes.Unit_OnDeath, gameObject);
     //事件移除
     EventRemove();
     //解引用
     GetPosition().CurrentUnit = null;
     //移除回合系统列表
     RoundSystem.Get().RemoveUnit(this);
 }
コード例 #25
0
 public override void OnServerSceneChanged(string sceneName)
 {
     if (previousSceneName == "Menu" && sceneName.StartsWith("Map"))
     {
         publicUIInstance = Instantiate(publicUI);
         NetworkServer.Spawn(publicUIInstance);
         playerSpawnSystemInstance = Instantiate(playerSpawnSystem);
         NetworkServer.Spawn(playerSpawnSystemInstance);
         roundSystemInstance  = Instantiate(roundSystem);
         roundSystemInstance2 = roundSystemInstance.GetComponent <RoundSystem>();
         NetworkServer.Spawn(roundSystemInstance);
         return;
     }
     if (sceneName.StartsWith("Map") && previousSceneName.StartsWith("Map"))
     {
         roundSystemInstance.GetComponent <RoundSystem>().StartFreeze();
     }
 }
コード例 #26
0
ファイル: CubeCell.cs プロジェクト: BATTLEHAWK00/MyFirstGame
 public void OnPointerClick(PointerEventData eventData)  //鼠标点击事件
 {
     if (eventData.button != PointerEventData.InputButton.Left)
     {
         return;
     }
     if (!RoundSystem.Get().IsWaitingPlayer())
     {
         return;
     }
     EventManager.Get().EventTrigger <CubeCell>(EventTypes.Cell_OnSelected, this);
     if (this.CurrentUnit != null)
     {
         UnitSelection.Get().Set(this);
     }
     if (UnitSelection.Get().GetStart() == this)
     {
         meshRenderer.material = OccupiedMaterial;
     }
     AudioManager.Get().PlaySound("Grid/OnClick", 0.1f);
 }
コード例 #27
0
    public override void ServerChangeScene(string newSceneName)
    {
        previousSceneName = SceneManager.GetActiveScene().name;
        if (newSceneName.StartsWith("Map"))
        {
            PlayerSpawnSystem.ClearSpawnPoints();
            if (previousSceneName == "Menu")
            {
                for (int i = RoomPlayers.Count - 1; i >= 0; i--)
                {
                    var conn = RoomPlayers[i].connectionToClient;
                    var gameplayerInstance = Instantiate(gamePlayerPrefab);
                    gameplayerInstance.SetDisplayName(RoomPlayers[i].DisplayName);
                    gameplayerInstance.SetTeam(RoomPlayers[i].Team);

                    NetworkServer.Destroy(conn.identity.gameObject);

                    NetworkServer.ReplacePlayerForConnection(conn, gameplayerInstance.gameObject);
                }
            }
        }
        if (newSceneName == "GameEnd" && previousSceneName.StartsWith("Map"))
        {
            NetworkServer.Destroy(playerSpawnSystemInstance);
            playerSpawnSystemInstance = null;
            NetworkServer.Destroy(publicUIInstance);
            publicUIInstance = null;
        }
        if (newSceneName == "Menu" && roundSystemInstance != null)
        {
            NetworkServer.Destroy(roundSystemInstance);
            roundSystemInstance  = null;
            roundSystemInstance2 = null;
        }

        base.ServerChangeScene(newSceneName);
    }
コード例 #28
0
 private void DefuseDone()
 {
     RoundSystem.DefuseBomb();
     Bomb.GetComponent <BombPlanted>().defused = true;
     StopDefuse();
 }
コード例 #29
0
 // Initialisierung des Roundsystems
 void Start()
 {
     fadeControl = GameObject.FindGameObjectWithTag("GameController").GetComponent <RoundSystem>();
 }
コード例 #30
0
 private void Start()
 {
     rs = rsObj.GetComponent <RoundSystem>();
 }