Пример #1
0
    private EnemyCreator enemy_creator = null;                  // 방해 캐릭터 크리에이터.

    // ================================================================ //
    // MonoBehaviour에서 상속.

    void    Start()
    {
        this.player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControl>();

        //

        this.last_block.is_created = false;

        this.level_control = new LevelControl();
        this.level_control.initialize();
        this.level_control.loadLevelData(this.level_data_text);

        this.player.level_control = this.level_control;

        //

        this.game_root     = this.gameObject.GetComponent <GameRoot>();
        this.block_creator = this.gameObject.GetComponent <BlockCreator>();
        this.coin_creator  = this.gameObject.GetComponent <CoinCreator>();
        this.enemy_creator = this.gameObject.GetComponent <EnemyCreator>();

        this.block_creator.map_creator = this;
        this.coin_creator.map_creator  = this;
        this.enemy_creator.map_creator = this;

        //

        this.create_floor_block();
    }
Пример #2
0
 public static BlockCreator GetSingleton()
 {
     if (singleton == null)
     {
         singleton = new GameObject("_BlockCreator").AddComponent <BlockCreator> ();
     }
     return(singleton);
 }
Пример #3
0
 public static BlockCreator GetSingleton()
 {
     if (instance == null)
     {
         instance = new GameObject("_BlockCreator").AddComponent <BlockCreator>();
     }
     return(instance);
 }
Пример #4
0
    // Use this for initialization
    void Start()
    {
        this.player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControl>();
        this.last_block.is_created = false;
        this.block_creator         = this.gameObject.GetComponent <BlockCreator>();

        this.level_control = new LevelControl();
        this.level_control.initialize();
    }
Пример #5
0
    IEnumerator CreateHingeJoint()
    {
        yield return(new WaitForSeconds(0.2f));

        hJoint = gameObject.AddComponent <HingeJoint> ();
        Vector3 blockTransform = BlockCreator.GetSingleton().GetRelativeBlock(transform.position.z);

        FindRelativePosForHingeJoint(blockTransform);
    }
Пример #6
0
        private void Check()
        {
            UpdateActiveByActualDate();
            var blockWithoutContentCount = BlockCreator.GetBlocksWithoutContent().Count;
            var outdatedRelationCount    = SiteObjectService.GetRelationWithNotActive().Count;

            if (blockWithoutContentCount > 0 || outdatedRelationCount > 0)
            {
                SendMail(CreateBody(blockWithoutContentCount, outdatedRelationCount));
            }
        }
Пример #7
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Пример #8
0
        private List <BlockModel> _GetInitialBlocks()
        {
            var blocks      = new List <BlockModel>();
            var smallBlock  = BlockCreator.GetRandomBlock(GameTypes.BlockSizeType.Small);
            var mediumBlock = BlockCreator.GetRandomBlock(GameTypes.BlockSizeType.Medium);
            var largeBlock  = BlockCreator.GetRandomBlock(GameTypes.BlockSizeType.Large);

            blocks.Add(smallBlock);
            blocks.Add(mediumBlock);
            blocks.Add(largeBlock);
            return(blocks);
        }
Пример #9
0
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControl>();
        last_block.is_created = false;
        block_creator         = GetComponent <BlockCreator>();
        item_creator          = GetComponent <ItemCreator>();
        monster_creator       = GetComponent <MonsterCreator>();
        game_root             = GetComponent <GameRoot>();

        level_control = new LevelControl();
        level_control.initialize();
        level_control.loadLevelData(this.level_data_text);
    }
Пример #10
0
 void Start()
 {
     this.player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControl>();
     this.last_block.is_created = false;
     this.block_creator         = this.gameObject.GetComponent <BlockCreator>();
     this.level_control         = new LevelControl();
     this.level_control.initialize();
     this.level_control.loadLevelData(this.level_data_text);
     this.game_root = this.gameObject.GetComponent <GameRoot>();
     this.game_root.level_control = this.level_control;
     this.player.level_control    = this.level_control;
     this.player.game_root        = this.game_root;
 }
Пример #11
0
    private void LateUpdate()
    {
        if (player != null)
        {
            transform.position = new Vector3(xPos, player.position.y - yDifference, player.position.z - zDifference);

            int passageIndex = Mathf.CeilToInt(player.position.z);
            if (passageIndex > lastPassageIndex + passageConstant)
            {
                lastPassageIndex = passageIndex;
                BlockCreator.GetSingleton().UpdateBlockPosition(lastPassageIndex);
            }
        }
    }
Пример #12
0
        public void CanWordBeSpelled_GivenBear_ShouldReturnTrue()
        {
            //arrange (test data)
            string incomingWord = "BEAR";

            var firstBlockCreator = new BlockCreator();
            var firstPile         = firstBlockCreator.CreateBlocks();

            var testInstance = new PuzzleSolver();

            //action (do some work)
            bool isItSpellable = testInstance.CanWordBeSpelled(incomingWord, firstPile);

            //assert - check that the result of your action is that what you expected
            Assert.True(isItSpellable);
        }
Пример #13
0
    void OnGUI()
    {
//		GUI.Label(new Rect(left,20,500,800), "HOW TO PLAY HOBO SOLITAIRE \n \nClick any block to begin. \nClick another block. \nYour move is scored and the previous block goes away. \nContinue until there's only one block left. \n\nScore points by: \n\nWORD: matching words \nSYMBOL: matching symbols \nSEQUENCE: going up by one number (9 wraps to 0) \nPROXIMITY: the blocks are touching \n\nWhen you score points in a category, the multiplier for that \ncategory increases.");
//
//		GUI.Label(new Rect(left,290,1000,20), "------------------------------------------------------------");

        GUI.Label(new Rect(left, 325, 1000, 20), "SPACEBAR = Reset Current Board");
        GUI.Label(new Rect(left, 345, 1000, 20), "N = Create New Board");


//		GUI.Label(new Rect(right,20,1000,20), "CURRENT MULTIPLIERS");
//		GUI.Label(new Rect(right,40,1000,20), "Symbol / Word = x" + ScoreKeeper.symWrdVal);
//		GUI.Label(new Rect(right,58,1000,20), "Sequence = x" + ScoreKeeper.seqVal);
//		GUI.Label(new Rect(right,76,1000,20), "Proximity = x" + ScoreKeeper.prxVal);
//
//		GUI.Label(new Rect(right,105,1000,20), "------------------------------------------------------------");
//
//		GUI.Label(new Rect(right,140,1000,20), "LAST MOVE");
//		GUI.Label(new Rect(right,160,1000,20), "Symbol = " + ScoreKeeper.symPts);
//		GUI.Label(new Rect(right,178,1000,20), "Word = " + ScoreKeeper.wrdPts);
//		GUI.Label(new Rect(right,196,1000,20), "Sequence = " + ScoreKeeper.seqPts);
//		GUI.Label(new Rect(right,214,1000,20), "Proximity = " + ScoreKeeper.prxPts);
//
//		GUI.Label(new Rect(right,242,1000,20), "Total  = " + ScoreKeeper.newPts);
//
//		GUI.Label(new Rect(right,275,1000,20), "------------------------------------------------------------");
//
//		GUI.Label(new Rect(right,310,1000,20), "SCORE  = " + ScoreKeeper.score);
//		GUI.Label(new Rect(right,330,1000,20), "Best Score for this Board  = " + ScoreKeeper.bestScore);


        //BOARD CODE STUFF

        GUI.Label(new Rect(left, 375, 1000, 20), "The code for this board = " + BlockCreator.currentSeed);

        boardCode = GUI.TextField(new Rect(left, 395, 55, 20), boardCode, 6);

        if (GUI.Button(new Rect(75, 395, 90, 20), "Enter Code"))
        {
            BlockCreator.ClearBoard();
            BlockCreator.FixedRandomizer();
            BlockCreator.PullBlocks();
            BlockCreator.MakeBoard();
        }

        GUI.Label(new Rect(left, 425, 1000, 200), BlockCreator.quote);
    }
Пример #14
0
    public void Start()
    {
        harmony = new Harmony("me.fistme.raft.autorecipe");
        harmony.PatchAll(Assembly.GetExecutingAssembly());

        // We use FindObjectsOfType() here in the case of mod unloading->loading, as Unity might not actually detach our scripts even if Destroy()ed
        foreach (var autoRecipe in FindObjectsOfType <AutoRecipeBehaviour>())
        {
            autoRecipe.Kill();
        }

        foreach (var comp in FindObjectsOfType <CookingPot_Recipe_UI>())
        {
            if (BlockCreator.GetPlacedBlocks().Contains(comp.GetComponent <Block>()))
            {
                comp.gameObject.AddComponent <AutoRecipeBehaviour>();
            }
        }
    }
Пример #15
0
        /// <summary>
        /// Sets a code block in this context. If the block exists, it is set in
        /// the context in which it was declared. Otherwise, it is declared in this context.
        /// </summary>
        /// <param name="name">the constant name</param>
        /// <param name="block">a method that can be called to initialize the block</param>
        public void SetBlock(string name, BlockCreator block)
        {
            ObjectContext c = FindBlockContext(name);

            if (c == null)
            {
                _blocks.Add(name, block);
#if SHOW_OBJECTS
                Console.WriteLine("{1} declared in {0}", GetHashCode(), name);
#endif
            }
            else
            {
                c._blocks[name] = block;
#if SHOW_OBJECTS
                Console.WriteLine("{1} set in {0}", c.GetHashCode(), name);
#endif
            }
        }
Пример #16
0
 void PointerDown()
 {
     if (!GameManager.Instance.IsGameOn)
     {
         ActionSystem.OnGameStarted?.Invoke();
     }
     isTouchingTheScreen = true;
     if (hJoint == null)
     {
         hJoint = gameObject.AddComponent <HingeJoint>();
         var target = BlockCreator.GetSingleton().GetRelativeBlock(transform.position);
         if (target != null)
         {
             FindRelativePosForHingeJoint(target.position, target.lossyScale.y);
         }
         else
         {
             print("NoTarget");
         }
     }
 }
    private CookingPot FindClosestCookingPot()
    {
        float      sqrMag     = float.MaxValue;
        CookingPot cookingPot = null;

        foreach (var block in BlockCreator.GetPlacedBlocks())
        {
            var candidate = block.GetComponent <CookingPot>();
            if (candidate == null || !Traverse.Create(candidate).Field <bool>("hasBeenPlaced").Value)
            {
                continue;
            }

            var sqrMagToCandidate = (candidate.transform.position - transform.position).sqrMagnitude;
            if (sqrMagToCandidate <= Player.UseDistance * Player.UseDistance && sqrMagToCandidate < sqrMag)
            {
                sqrMag     = sqrMagToCandidate;
                cookingPot = candidate;
            }
        }

        return(cookingPot);
    }
Пример #18
0
 private static void BlockCreator_CreateBlock(BlockCreator __instance, Block __result) => Get.OnBlockCreated(__result);
Пример #19
0
 // Use this for initialization
 void Start()
 {
     player = GameObject.FindGameObjectWithTag ("Player").GetComponent<PlayerControl> ();
     last_block.is_created = false;
     blockCreator = gameObject.GetComponent<BlockCreator> ();
 }
Пример #20
0
    // ================================================================ //
    // MonoBehaviour からの継承.
    void Start()
    {
        this.player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerControl>();

        //

        this.last_block.is_created = false;

        this.level_control = new LevelControl();
        this.level_control.initialize();
        this.level_control.loadLevelData(this.level_data_text);

        this.player.level_control = this.level_control;

        //

        this.game_root     = this.gameObject.GetComponent<GameRoot>();
        this.block_creator = this.gameObject.GetComponent<BlockCreator>();
        this.coin_creator  = this.gameObject.GetComponent<CoinCreator>();
        this.enemy_creator = this.gameObject.GetComponent<EnemyCreator>();

        this.block_creator.map_creator = this;
        this.coin_creator.map_creator = this;
        this.enemy_creator.map_creator = this;

        //

        this.create_floor_block();
    }
Пример #21
0
    void Start()
    {
        this.player = GameObject.FindGameObjectWithTag(
            "Player").GetComponent<PlayerControl>();
        this.last_block.is_created = false;
        this.block_creator = this.gameObject.GetComponent<BlockCreator>();

        this.level_control = new LevelControl();
        this.level_control.initialize();
    }
Пример #22
0
 void Start()
 {
     BlockCreator.GetSingleton().Initialize(30, blockPrefabs, pointPrefab);
     FindRelativePosForHingeJoint(new Vector3(0, 5, 0));
 }
Пример #23
0
 // Use this for initialization
 void Start()
 {
     blockC = GetComponent<BlockCreator> ();
 }
Пример #24
0
    // Use this for initialization
    void Start()
    {
        this.player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerControl>();
        this.last_block.is_created = false;
        this.block_creator = this.gameObject.GetComponent<BlockCreator>();

        this.level_control = new LevelControl();
        this.level_control.initialize();

        //テキストからデータを読み出す
        this.level_control.loadLevelData(this.level_data_text);

        this.game_root = this.gameObject.GetComponent<GameRoot>();

        this.player.level_control = this.level_control;
    }
Пример #25
0
 // Use this for initialization
 void Start()
 {
     blockC = GetComponent <BlockCreator> ();
 }