Esempio n. 1
0
        public WinController(MissionConstruct mc, MatchBoard gB)
        {
            Result = GameResult.None;

            mGrid         = gB.grid;
            mBoard        = gB;
            movesCostrain = mc.MovesConstrain;
            MovesRest     = movesCostrain;
            ScoreTarget   = mc.ScoreTarget;
            botDynCells   = mBoard.grid.GetBottomDynCells();

            #region time
            timeCostrain = mc.TimeConstrain;
            IsTimeLevel  = mc.IsTimeLevel;
            if (IsTimeLevel)
            {
                MovesRest = 0;
                Timer     = new SessionTimer(timeCostrain);
                Timer.TickRestFullSecondsEvent += (s) => { TimerTickEvent?.Invoke(s); };
                Timer.TickRestFullSecondsEvent += (sec) => { TimeRest = (int)sec; if (TimeRest == 30)
                                                             {
                                                                 TimerLeft30Event?.Invoke();
                                                             }
                };
                Timer.TimePassedEvent += () => { if (Result == GameResult.None)
                                                 {
                                                     CheckResult();
                                                 }
                };
            }
            #endregion time
        }
Esempio n. 2
0
    public void InitializeReferences(GameObject [] Prefabs, GameObject p1Indicator, GameObject p2Indicator)
    {
        board = this.gameObject.AddComponent<MatchBoard>();
        input = this.gameObject.AddComponent<PlayerInput>();
        input.initIndicators(p1Indicator, p2Indicator);
        giver = this.gameObject.AddComponent<ResourceGiver>();
        audio = this.gameObject.GetComponent<AudioSource>();
        matchSound = audio.clip;
        muted = false;

        TilePrefabs = Prefabs;
        InitializeTypes();
        InitializeSpawn();
    }
Esempio n. 3
0
    public void Start()
    {
        lastMatches = new Queue<TileType>(3);
        bonuses = new HashSet<TileDetail>();
        gameState = GameState.instance;
        score = 0;
        levelLaw = Random.Range(48,53);
        levelRobot = Random.Range(48,53);
        levelReligion = Random.Range(48,53);
        //levelReligion = 0; bonuses.Add(TileDetail.Science); // +++

        dudeFactory.MakeDudes(Screen.width - boardWidth, Screen.width, 0, 6,
            gameState.isRobotEnemy, gameState.isReligionEnemy, gameState.isLawEnemy);
        targetStyle = new GUIStyle(skin.label);
        targetStyle.alignment = TextAnchor.UpperRight;

        levelWidth = (Screen.width - boardWidth);
        levelRobotRect = new Rect(0, Screen.height - (levelHeight * 3),
            levelWidth, levelHeight);
        levelReligionRect = new Rect(0, Screen.height - (levelHeight * 2),
            Screen.width - boardWidth, levelHeight);
        levelLawRect = new Rect(0, Screen.height - levelHeight,
            Screen.width - boardWidth, levelHeight);

        scoreRect = new Rect(0, 0, Screen.width - boardWidth,
            Screen.height - levelHeight * 3);

        board = GameObject.Find("Board").GetComponent<MatchBoard>();
        StartGame();
    }
Esempio n. 4
0
 void Start()
 {
     board = GameObject.Find("Board").GetComponent<MatchBoard>();
     ease = Interpolate.Ease(Interpolate.EaseType.EaseOutCubic);
     // choose a random square type
     System.Array types = System.Enum.GetValues(typeof(TileType));
     type = (TileType)types.GetValue(Random.Range(1, types.Length));
     detail = TileDetail.Get(type);
     UpdateName();
     Material mat = GetComponentInChildren<MeshRenderer>().material;
     //mat.color = colors[(int)type - 1];
     //mat.mainTexture = textures[(int)type - 1];
     mat.mainTexture = detail.texture;
 }