Наследование: MonoBehaviour
Пример #1
0
 void Awake()
 {
     archManager = GameObject.Find ("ArchManager").GetComponent<ArchManager>();
     gameManager = GameObject.Find ("GameManager").GetComponent<GameManager>();
     tileManager = GameObject.Find ("TileManager").GetComponent<TileManager>();
     materialManager = GameObject.Find ("MaterialManager").GetComponent<MaterialManager>();
 }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     list_scr = list_obj.GetComponent<TileManager>();
     position = 0;
     Invoke("Go", 2);
     uiText.GetComponent<Text>().text = "";
 }
Пример #3
0
 public LevelManagerr(ContentManager content)
 {
     TileManager = new TileManager(content, 32, 32);
     TileManager.AddBackground("Images/Bgs/bg1");
     TileManager.AddTileType('G', "Images/Tiles/ground", CollisionType.Full);
     TileManager.AddTileType('^', "Images/Obstacles/thorns", CollisionType.PerPixelCollision);
 }
Пример #4
0
    void OnLevelWasLoaded(int level)
    {
        if (level != MainScene)
            return;

        gameManager = GameObject.Find ("GameManager").GetComponent<GameManager>();
        tileManager = GameObject.Find ("TileManager").GetComponent<TileManager>();

        if (teamID == 0)
        {
            archUnit = (GameObject) PhotonNetwork.Instantiate(
                archPrefabNameA,
                tileManager.tileArray[gameManager.archSpawnA].position,
                Quaternion.identity, 0);
        }
        else
        {
            archUnit = (GameObject) PhotonNetwork.Instantiate(
                archPrefabNameB,
                tileManager.tileArray[gameManager.archSpawnB].position,
                Quaternion.identity, 0);
        }

        archUnit.GetComponent<SetupObjects>().Setup();
        Destroy(gameObject);
    }
Пример #5
0
        public override void LoadContent(Player player, MapBase theMap)
        {
            base.LoadContent(player,theMap);

            player.MapBoundry = MapBoundry;

            MapTiles = new TileManager(Game1.Textures["tiles"]);

            datasource = new TileLayoutDataSource(@"Map\BeginingMapTileLayout.csv", MapTiles);
            datasource.LoadContent();

            Texture2D playerTexture = Game1.Textures["player"];

            testCharacter = new Enemy(Game1.Textures["blackKnight"], new Vector2(250, 250),theMap,MapBoundry);
            enemy2 = new Enemy(Game1.Textures["blackKnight"], new Vector2(500, 500), theMap, MapBoundry);
            textBox = new TextBox(Game1.gameFont,Game1.Textures["textBox"]);

            basicSword = new Sword("Basic Sword", Game1.Textures["sword"], new Vector2(200, 50), ItemType.Weapon,false);

            MovingElements.Add(player);
            MovingElements.Add(testCharacter);
            MovingElements.Add(enemy2);
            ImmovableObjects.AddRange(datasource.GetCollisionTiles());
            ItemsAvailable.Add(basicSword);
        }
Пример #6
0
 void Awake()
 {
     unitArrayA = new GameObject[100];
     unitArrayB = new GameObject[100];
     gameManager = GameObject.Find ("GameManager").GetComponent<GameManager>();
     tileManager = GameObject.Find ("TileManager").GetComponent<TileManager>();
 }
Пример #7
0
 // Use this for initialization
 void Awake()
 {
     playerIndex = 0;
     tileManager = GameObject.FindGameObjectWithTag("Game").GetComponent<TileManager>();
      ani = gameObject.GetComponent<Animator>();
      source = GetComponent<AudioSource>();
 }
Пример #8
0
 // Use this for initialization
 void Start()
 {
     castleCount = 0;
     isPlacing = false;
     playerManager = GetComponent<PlayerManager>();
     tileManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent<TileManager>();
 }
Пример #9
0
 void Start()
 {
     GameObject tileHolders = GameObject.Find("Tile Holders");
     if(tileHolders != null)
     {
         tileManager = tileHolders.GetComponent<TileManager>();
     }
 }
Пример #10
0
        public TileManagerDataContext( TileManager tileManager )
        {
            mTileManager = tileManager;

            mTileManager.PropertyChanged += PropertyChangedHandler;
            mTileManager.Internal.PropertyChanged += PropertyChangedHandler;
            mProgressTimer.Tick += CheckProgress;
        }
Пример #11
0
    void Awake()
    {
        if (instance == null)
            instance = this;

        else if (instance != this)
            Destroy(gameObject);

        DontDestroyOnLoad(gameObject);
    }
Пример #12
0
	// Use this for initialization
	void Start () 
	{
		instance = this;


		SpawnTiles();
		SpawnSheep();
		SpawnPens();

	}
Пример #13
0
    // Use this for initialization
    void Awake()
    {
        tileManager = GetComponent<TileManager> ();
        playerManager = GetComponent<PlayerManager> ();
        source = gameObject.GetComponent<AudioSource>();

        //Centre camera on middle of tiles
        Vector2 cameraPos = tileManager.GetCentrePoint ();
        gameCam.SetPosition(new Vector3 (cameraPos.x, cameraPos.y, gameCam.transform.localPosition.z));
    }
Пример #14
0
    protected virtual void Start()
    {
        mGUIManager = GameObject.Find("Main Camera").GetComponent<GUIManager>();
        mLevelManager = GameObject.Find("Main Camera").GetComponent<LevelManager>();
        mTileManager = GameObject.Find("Main Camera").GetComponent<TileManager>();
        mTowerManager = GameObject.Find("Main Camera").GetComponent<TowerManager>();

        mActive = false;
        mHover = false;
    }
Пример #15
0
 public void Awake()
 {
     tileManager = (TileManager)target;
     resourceManager = tileManager.GetComponent<ResourceManager>();
     improvementManager = tileManager.GetComponent<ImprovementManager>();
     if (tileManager.tiles != null)
     {
         foldoutOpen = new bool[tileManager.tiles.Count];
     }
 }
Пример #16
0
    protected virtual void Awake()
    {
        gameMgr = GameObject.FindObjectOfType<GameManager>();
        tileMgr = GameObject.FindObjectOfType<TileManager>();
        newsfeed = GameObject.FindObjectOfType<Newsfeed>();

        goatUseEffectPrefab = Resources.Load<GameObject>("Prefabs/Goat Use");

        GetComponent<SpriteRenderer>().sprite = messages[Random.Range(0, 3)];

        transform.localScale = Vector2.one * 1.5f;
    }
Пример #17
0
    // Sets up the map
    public void SetupScene()
    {
        string[] seasons = { "WINTER", "SPRING", "SUMMER", "FALL" };
        season = seasons[Random.Range(0, 4)];

        numCave = Random.Range(2, 4);       // 2 to 3 caves
        numMarket = Random.Range(7, 11);    // 7 to 10 markets
        numFarm = Random.Range(5, 11);      // 5 to 10 farms
        tileManager = GetComponent<TileManager>();

        grid = new Grid(columns, rows);
        initMap();
        MapSetup();
    }
Пример #18
0
    // Sets up the map
    public void SetupScene()
    {
        string[] seasons = { "winter", "spring", "summer", "fall" };
        season = seasons[Random.Range(0, 4)];

        numCave     = Random.Range(1, 3);   // 1 to 2 caves
        numMarket   = Random.Range(7, 11);  // 7 to 10 markets
        numFarm     = Random.Range(7, 10);  // 7 to 10 farms
        tileManager = GetComponent <TileManager>();

        grid = new Grid(columns, rows);
        initMap();
        MapSetup();
        GetReferences();
        SetupNPCs();
    }
Пример #19
0
    // Sets up the map
    public void SetupScene()
    {
        string[] seasons = { "winter", "spring", "summer", "fall" };
        season = seasons[Random.Range(0, 4)];

        numCave = Random.Range(1, 3);       // 1 to 2 caves
        numMarket = Random.Range(7, 11);    // 7 to 10 markets
        numFarm = Random.Range(7, 10);      // 7 to 10 farms
        tileManager = GetComponent<TileManager>();

        grid = new Grid(columns, rows);
        initMap();
        MapSetup();
        GetReferences();
        SetupNPCs();
    }
Пример #20
0
        public void Init(int2 position, TileManager manager, int2 chunkSize, int2 mapSize, Material tileMaterial, Material lightMaterial)
        {
            tileManager   = manager;
            chunkPosition = position;
            mesh.Init(chunkSize, mapSize, chunkPosition, tileMaterial);
            lightTexture.Init(chunkSize, mapSize, chunkPosition, lightMaterial);

            int2    lightTextureTilePosition = TileUtil.TileToWorldTile(int2.zero, chunkPosition, chunkSize);
            Vector3 lightTexturePosition     = new Vector3(lightTextureTilePosition.x, lightTextureTilePosition.y);

            lightTexturePosition.z         -= 10;
            lightTexture.transform.position = lightTexturePosition;

            meshDirty  = true;
            lightDirty = true;
        }
Пример #21
0
    public void LoadPlayField()
    {
        Debug.Log("Start game");
        TileManager.currentid = 0;
        int lastPos = 0;

        for (int i = 0; i < playerControllers.Count; i++)
        {
            Debug.Log("create field");
            TileManager t = new TileManager(playerControllers [i], lastPos, fieldHeightValue, fieldWidthValue);
            tileManagers.Add(t);
            lastPos += fieldHeightValue + offsetField;
        }

        newCamPosition = new Vector3(((lastPos - ((offsetField * playerCountValue) / 2f)) / 2f) - .5f, ((fieldWidthValue / 2f) * -1f) + .5f, fieldWidthValue * -1f);
    }
Пример #22
0
    void Reset()
    {
        // Logic to perform on resetting the game (called in Enter_StartMenu)
        bIsSuccess = false;

        if (Player.thePlayer != null)
        {
            Player.thePlayer.Reset();
        }

        TileManager theTileManager = Core.theCore.GetComponent <TileManager>();

        if (theTileManager != null)
        {
            theTileManager.Reset();
        }

        Camera.main.transform.position = new Vector3(0.0f, 1.0f, -10.0f);

        // Reset all menus to default state
        if (mainMenu != null)
        {
            mainMenu.SetActive(true);
        }

        if (pauseMenu != null)
        {
            pauseMenu.SetActive(false);
        }

        if (endGameMenu != null)
        {
            endGameMenu.SetActive(false);
        }

        if (HUD != null)
        {
            HUD.SetActive(false);
        }

        UI_HUD HUDClass = GetComponent <UI_HUD>();

        if (HUDClass != null)
        {
            HUDClass.Reset();
        }
    }
Пример #23
0
    public static void RenderMap(int[,] map)
    {
        TileManager tm = GameObject.FindGameObjectWithTag("GameController").GetComponent <TileManager>();
        //Clear the map (ensures we dont overlap)
        Tilemap sea       = tm.Sea_Map;
        Tilemap ground    = tm.Ground_Map;
        Tilemap mountains = tm.Collision_Map;

        ground.ClearAllTiles();
        sea.ClearAllTiles();
        mountains.ClearAllTiles();
        //Loop through the width of the map
        for (int x = 0; x < map.GetLength(0); x++)
        {
            //Loop through the height of the map
            for (int y = 0; y < map.GetLength(1); y++)
            {
                if (map[x, y] == 1)
                {
                    ground.SetTile(new Vector3Int(x, y, 0), tm.Grass_Base);
                }
                else if (map[x, y] == 2)
                {
                    mountains.SetTile(new Vector3Int(x, y, 0), tm.Mountain_1);
                    ground.SetTile(new Vector3Int(x, y, 0), tm.Grass_Base);
                }
                else if (map[x, y] == 3)
                {
                    ground.SetTile(new Vector3Int(x, y, 0), tm.Sand_Base);
                }
                else if (map[x, y] == 4)
                {
                    mountains.SetTile(new Vector3Int(x, y, 0), tm.Grass_Flowers);
                    ground.SetTile(new Vector3Int(x, y, 0), tm.Grass_Base);
                }
                else if (map[x, y] == 5)
                {
                    mountains.SetTile(new Vector3Int(x, y, 0), tm.Grass_Rock);
                    ground.SetTile(new Vector3Int(x, y, 0), tm.Grass_Base);
                }
                else
                {
                    sea.SetTile(new Vector3Int(x, y, 0), tm.Water_Base);
                }
            }
        }
    }
Пример #24
0
    void OnGUI()
    {
        height = EditorGUILayout.IntSlider("Height", height, 8, 24);
        width  = EditorGUILayout.IntSlider("Width", width, 8, 24);


        if (GUILayout.Button("Build " + width + "x" + height + " Map"))
        {
            GameObject parent = new GameObject("Tiles");
            parent.AddComponent <PathManager>();
            TileManager tileManager = parent.AddComponent <TileManager>();
            tileManager.StageLength = height;
            tileManager.StageWidth  = width;
            for (int i = 0; i < width; i++)
            {
                for (int j = 0; j < height; j++)
                {
                    GameObject tileObject = new GameObject();
                    Tile       t          = tileObject.AddComponent <Tile>();
                    t.X                         = i;
                    t.Y                         = j;
                    tileObject.name             = "[" + i + "," + j + "]";
                    tileObject.transform.parent = parent.transform;
                }
            }
        }

        if (GUILayout.Button("Initialize Collision"))
        {
            GameObject parent = GameObject.Find("Tiles");
            foreach (Transform t in parent.transform)
            {
                BoxCollider b = t.GetComponent <BoxCollider>();
                if (b == null)
                {
                    b = t.gameObject.AddComponent <BoxCollider>();
                }

                Tile tile = t.GetComponent <Tile>();

                float height = (tile.Height + tile.Depth + (tile.Slope / 2f)) * parent.GetComponent <TileManager>().TileHeightScale;

                b.size   = new Vector3(1, height, 1);
                b.center = new Vector3(0, -height / 2f, 0);
            }
        }
    }
Пример #25
0
    /// <summary>
    /// Let AI place its penguin on an optimal tile
    /// </summary>
    ///
    public void PlacePenguinAI(Player current)
    {
        const float MinDist = 3.0f;

        m_refAIBoard.UpdateHeuristicMap();

        List <VTile> allTiles = new List <VTile>(m_refAIBoard.tileTable.Values);

        AIBoardSim.SortVTiles(allTiles);

        int length = allTiles.Count;

        VTile vtile = null;

        GameTile tile = null;

        GamePenguin lastPen = current.lastAddedPenguin;

        // Scan highest scored tiles for first available one-fish tile
        //
        for (int index = 0; index < length; index++)
        {
            vtile = allTiles[index];

            tile = m_refTileMgr.tileTable[vtile.tileID];

            if (lastPen != null)
            {
                // Try not to place AI's penguins too close together, or it will be too easy for the
                //  other players to "gang up" on them.
                //
                if (TileManager.Distance(tile, lastPen.CurrentTile) < MinDist)
                {
                    continue;
                }
            }

            if (tile.numFish == 1 && !tile.IsPenguinHere)
            {
                break;                                             // Appropriate tile found -- Loop ends
            }
        }

        // Place penguin on that tile
        //
        current.AddPenguin(this, tile, true);
    }
Пример #26
0
    public IEnumerator GoToJailCoroutine() //send to jail, RIGHT THROUGH BOARD, DO NOT PASS OTHER TILES
    {
        Vector3 finalPosition = TileManager.GetTile(10).GetTilePosition();

        while (currentPosition != finalPosition)
        {
            currentPosition = Vector3.MoveTowards(currentPosition, finalPosition, 20f);
            {
                UpdatePosition();
                yield return(null);
            }
        }
        currentWaypoint = 10;
        inJail          = true;
        PlayerInformationManager.UpdatePlayerInfo();
        GameLoop.EndTurn();
    }
Пример #27
0
 void AddToStorage(int _index)
 {
     for (int a = 0; a < TileManager.GetTileHolder(m_tilesAround[_index].Type).Tiles.Count; ++a)
     {
         if (TileManager.GetTileHolder(m_tilesAround[_index].Type).Tiles[a].ID == m_tilesAround[_index].ID)
         {
             ShouldBlockDrop(_index);
             m_tilesAround[_index] = TileManager.GetTileHolder(m_tilesAround[_index].Type).Tiles[a];
         }
     }
     if (m_tilesAround[_index].ShouldGiveScore)
     {
         m_tilesAround[_index].ScoreDispense = Random.Range(m_tilesAround[_index].ScoreDispenseMin, m_tilesAround[_index].ScoreDispenseMax);
         m_tilesAround[_index].ScoreDispense = (int)m_tilesAround[_index].ScoreDispense;
         m_source.GetComponent <Scoring>().IncreaseScore(m_tilesAround[_index].ScoreDispense);
     }
 }
Пример #28
0
        /**
         * Sets the tile at the given position
         * to the currently selected tile type.
         *
         * Will create the tile if one does not exist
         */
        public static void SetTile(TileManager tileManager, TileDefinition tileDefinition, int x, int y)
        {
            // Copy array to avoid dupplication between editor and tilemap
            Fixture[] f = (Fixture[])tileDefinition.fixtures.Clone();
            tileDefinition.fixtures = f;

            if (tileManager.GetTile(x, y) == null)
            {
                tileManager.EditorCreateTile(x, y, tileDefinition);
                Undo.RegisterCreatedObjectUndo(tileManager.GetTile(x, y).gameObject, "Created tile");
            }
            else
            {
                Undo.RecordObject(tileManager.GetTile(x, y).gameObject, "Updated tile");
                tileManager.EditorUpdateTile(x, y, tileDefinition);
            }
        }
    // 오브젝트 배치
    // 클릭시 해당 버튼에 대해 프리팹 셋팅 된 오브젝트를 생성
    // 클릭시 인벤토리 탭, ray 차단 Background SetActive(false)
    // isLoad: Save/Load 시 오브젝트 생성에 사용하기위한 플래그
    public GameObject ObjectInstantiater(int itemType, Sprite sprite, string serial, bool isLoad = false)
    {
        // idx
        // : ItemController._itemType.[enum]
        // 낮이라면 오브젝트 배치 불가
        if (GameObject.Find("GameManager").GetComponent <DayController>().isDaytime)
        {
            return(null);
        }

        // 인벤토리 탭 닫기
        if (!isLoad)
        {
            TapClicked(2);
        }

        // 베이스 오브젝트(의자, 테이블 등) 동적 생성
        target = Instantiate(ObjectsPrefab[itemType], new Vector3(-600f, 0, 0), transform.rotation);

        // 그 오브젝트에 정보 덮어씌우기(이미지, 시리얼 번호 등)
        // 이미지
        target.GetComponent <SpriteRenderer>().sprite = sprite;

        TileManager tmpTileManager = target.GetComponent <TileManager>();

        // 타일이라면 타일 이미지 설정
        if (tmpTileManager != null)
        {
            tmpTileManager.setTile(sprite);
        }

        // 시리얼 번호 할당
        target.GetComponent <SerialNumbManager>().setSerialNumb(serial);


        // 활성화 Floor의 하위에 오브젝트 생성 및 전달
        // renderer.enabled()를 제어하기 위함
        if (!isLoad)
        {
            GameObject.Find("GameManager").GetComponent <FloorArranger>().ButtonClicker(target); return(null);
        }
        else // Load를 위한 오브젝트 생성이라면
        {
            return(target);
        }
    }
Пример #30
0
    private void FillPathCellInfo()
    {
        pathGrid = new PathCellInfo[levelBounds.width, levelBounds.height];

        for (int y = levelBounds.min.y; y < levelBounds.max.y; ++y)
        {
            for (int x = levelBounds.min.x; x < levelBounds.max.x; ++x)
            {
                Tile tile     = GetTile(x, y);
                bool passable = TileManager.GetData(tile).passable;

                pathGrid[x, y] = new PathCellInfo(passable, false, passable ? 0 : int.MaxValue);
            }
        }

        pathfinder = new Pathfinder(this, pathGrid);
    }
Пример #31
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(gameObject);
     }
     else
     {
         _instance = this;
     }
     tiles = GetComponentsInChildren <Tile>();
     tileRespawnPointsParent = transform.GetChild(0).gameObject;
     for (int i = 0; i < tileRespawnPointsParent.transform.childCount; i++)
     {
         tileRespawnPoints.Add(tileRespawnPointsParent.transform.GetChild(i).position);
     }
 }
Пример #32
0
        private void PinToStart_Click(object sender, RoutedEventArgs e)
        {
            if (List.ItemContainerGenerator == null)
            {
                return;
            }
            var selectedListBoxItem = List.ItemContainerGenerator.ContainerFromItem(((MenuItem)sender).DataContext) as ListBoxItem;

            if (selectedListBoxItem == null)
            {
                return;
            }
            var selectedIndex = List.ItemContainerGenerator.IndexFromContainer(selectedListBoxItem);
            var estacion      = (Product)List.Items[selectedIndex];

            TileManager.Set(new Uri(string.Format("/Views/LugarDetalles.xaml?id={0}", estacion.Id), UriKind.Relative), "", new Uri(string.Format("/Images/Products/product_{0}.jpg", estacion.Id), UriKind.Relative));
        }
Пример #33
0
        static public void InitLuminance(TileManager tileManager)
        {
            for (int x = 0; x < tileManager.sizeX; x++)
            {
                for (int z = 0; z < tileManager.sizeZ; z++)
                {
                    for (int y = tileManager.sizeY - 1; y >= 0; y--)
                    {
                        TilePosition pos = new TilePosition(x, y, z);

                        tileManager.SetTileAmbientLuminance(pos, Tile.MAX_LUMINANCE);

                        if (tileManager.GetTileCastShadow(pos))
                        {
                            break;
                        }
                    }
                }
            }

            for (int x = 0; x < tileManager.sizeX; x++)
            {
                for (int z = 0; z < tileManager.sizeZ; z++)
                {
                    for (int y = tileManager.sizeY - 1; y >= 0; y--)
                    {
                        TilePosition pos = new TilePosition(x, y, z);

                        if (tileManager.GetTileAmbientLuminance(pos) == 0)
                        {
                            break;
                        }

                        if (x > 0 && tileManager.GetTileAmbientLuminance(pos + new TilePosition(-1, 0, 0)) == 0 ||
                            x < tileManager.sizeX - 1 && tileManager.GetTileAmbientLuminance(pos + new TilePosition(1, 0, 0)) == 0 ||
                            z > 0 && tileManager.GetTileAmbientLuminance(pos + new TilePosition(0, 0, -1)) == 0 ||
                            z < tileManager.sizeZ - 1 && tileManager.GetTileAmbientLuminance(pos + new TilePosition(0, 0, 1)) == 0)
                        {
                            pendingUpdateLights.Add(PositionToInt(x, y, z));
                        }
                    }
                }
            }

            UpdateLuminanceLightVector(tileManager);
        }
Пример #34
0
        /**
         * Creates a fake tile to use in-editor
         */
        public static TileObject CreateGhostTile(TileManager manager, TileDefinition definition, string append = "")
        {
            // Create the tile
            var gameObject = new GameObject("Ghost Tile" + append);
            var tile = gameObject.AddComponent<TileObject>();
            tile.Tile = definition;

            var meshes = gameObject.GetComponentsInChildren<MeshRenderer>();
            foreach (var mesh in meshes) {
                mesh.sharedMaterial.color = mesh.sharedMaterial.color * new Color(1.0f, 1.0f, 1.0f, 0.5f);
            }

            gameObject.transform.SetParent(manager.transform);
            gameObject.tag = "EditorOnly";

            return tile;
        }
    void FixedUpdate()
    {
        if (!activating)
        {
            return;
        }

        GameObject touchingTile = TouchManager.GetTouchingTile();

        if (touchingTile == null)
        {
            return;
        }

        TileManager.GetInstance().TransformTile(touchingTile, "");
        Deactivate(true);
    }
Пример #36
0
        public PriceListHomeViewModel(ICatalogEntityFactory entityFactory, IViewModelsFactory <IPriceListViewModel> itemVmFactory,
                                      IViewModelsFactory <ICreatePriceListViewModel> wizardVmFactory,
                                      IRepositoryFactory <IPricelistRepository> pricelistRepository, IAuthenticationContext authContext,
                                      INavigationManager navManager, TileManager tileManager)
        {
            _entityFactory       = entityFactory;
            _pricelistRepository = pricelistRepository;
            _authContext         = authContext;
            _wizardVmFactory     = wizardVmFactory;
            _itemVmFactory       = itemVmFactory;
            _navManager          = navManager;
            _tileManager         = tileManager;

            ClearFiltersCommand = new DelegateCommand(DoClearFilters);

            PopulateTiles();
        }
Пример #37
0
    private bool IsFusionWorking(TileManager tile, int testX, int testY)
    {
        if (tile.CharacterOnTile == null)
        {
            return(false);
        }
        CharacterManager tileCharacter    = tile.CharacterOnTile;
        CharacterManager tileOneCharacter = GetTile((int)tile.Position.x + testX, (int)tile.Position.y + testY).CharacterOnTile;
        CharacterManager tileTwoCharacter = GetTile((int)tile.Position.x + (testX * -1), (int)tile.Position.y + (testY * -1)).CharacterOnTile;

        if (tileOneCharacter == null || tileTwoCharacter == null || tileCharacter.Level != tileOneCharacter.Level || tileCharacter.Level != tileTwoCharacter.Level ||
            tileCharacter.Type != tileOneCharacter.Type || tileCharacter.Type != tileTwoCharacter.Type)
        {
            return(false);
        }
        return(true);
    }
Пример #38
0
 // Use this for initialization
 void Start()
 {
     AudioManager.getInstance().play(BGM, 0.5f);
     p1StartY         = Player1Water.GetComponent <RectTransform>().position.y;
     p1WaterTransform = Player1Water.GetComponent <RectTransform>();
     p2StartY         = Player2Water.GetComponent <RectTransform>().position.y;
     p2WaterTransform = Player2Water.GetComponent <RectTransform>();
     lostWater        = 0;
     gameState        = GameState.countdown;
     countdown        = FindObjectOfType <Countdown>();
     tileManager      = FindObjectOfType <TileManager>();
     soundbool        = true;
     if (tileManager == null)
     {
         throw new UnityException("Tile manager missing");
     }
 }
Пример #39
0
    public void TestAddSubscriber()
    {
        List <TriggerInstance> listeners = new List <TriggerInstance>();

        Assert.AreEqual(0, manager.subscribers.Count);

        // We subscribe a trigger
        string          trigger_description = "{\"scope\": \"ADJACENT\", \"when\": \"ALWAYS\", \"effect\": {\"resource\": \"MONEY\", \"value\": 2}, \"type\": \"GREEN\"}";
        Trigger         trigger_            = Trigger.LoadFromJson(JSON.Parse(trigger_description) as JSONClass);
        TriggerInstance trigger             = new TriggerInstance(trigger_, suburbs); // Bogus TileInstance

        manager.AddSubscriber(trigger);

        Assert.AreEqual(1, manager.subscribers.Count);
        TileType type_green = new TileType(ETileColor.GREEN);

        Assert.AreEqual(true, manager.subscribers.ContainsKey(type_green));
        manager.subscribers.TryGetValue(type_green, out listeners);
        Assert.AreEqual(1, listeners.Count);
        Assert.AreEqual(true, listeners.Contains(trigger));

        // We subscribe a tile with a trigger
        manager = new TileManager();
        Assert.AreEqual(0, manager.subscribers.Count);
        string       mint_description = "{\"name\": \"Mint\", \"triggers\": [{\"scope\": \"OWN\", \"when\": \"ALWAYS\", \"effect\": {\"resource\": \"MONEY\", \"value\": 2}, \"type\": \"GREY\"}], \"color\": \"GREY\", \"price\": 15, \"number\": 2, \"immediate\": {\"resource\": \"INCOME\", \"value\": 3}, \"letter\": \"A\", \"icon\": \"NONE\"}";
        Tile         mint_            = GetTileFromString(mint_description);
        TileInstance mint             = new TileInstance(mint_);

        mint.position = new TilePosition(0, 6);
        mint.owner    = player;
        manager.AddSubscriber(mint);

        Assert.AreEqual(1, manager.subscribers.Count);
        TileType type_grey = new TileType(ETileColor.GREY);

        Assert.AreEqual(true, manager.subscribers.ContainsKey(type_grey));
        manager.subscribers.TryGetValue(type_grey, out listeners);
        Assert.AreEqual(true, listeners.Contains(mint.triggers[0]));

        // We subscribe a tile with no trigger
        manager = new TileManager();
        Assert.AreEqual(0, manager.subscribers.Count);
        manager.AddSubscriber(suburbs);

        Assert.AreEqual(0, manager.subscribers.Count);
    }
Пример #40
0
        private int UpdateTileLevel(TileManager tileManager, Tile tile, TilePosition pos, int level)
        {
            TilePosition posAbove = pos + new TilePosition(0, 1, 0);

            bool aboveIsSameLiquid = tileManager.IsValidTile(posAbove) && tileManager.GetTileType(posAbove) == tile.tileType;

            int nearLowestLevel = int.MaxValue;

            if (aboveIsSameLiquid == false)
            {
                nearLowestLevel = GetLowerLevel(new TilePosition(1, 0, 0), tileManager, tile, pos, nearLowestLevel);
                nearLowestLevel = GetLowerLevel(new TilePosition(-1, 0, 0), tileManager, tile, pos, nearLowestLevel);
                nearLowestLevel = GetLowerLevel(new TilePosition(0, 0, 1), tileManager, tile, pos, nearLowestLevel);
                nearLowestLevel = GetLowerLevel(new TilePosition(0, 0, -1), tileManager, tile, pos, nearLowestLevel);
            }
            else
            {
                nearLowestLevel = 0;
            }

            if (nearLowestLevel != int.MaxValue)
            {
                if (nearLowestLevel + 1 != level)
                {
                    if (nearLowestLevel + 1 > level)
                    {
                        level++;
                        tileManager.SetTileExtraData(pos, (byte)level);
                    }
                    else
                    {
                        if (level > 1)
                        {
                            level--;
                            tileManager.SetTileExtraData(pos, (byte)level);
                        }
                    }
                }
            }
            else
            {
                level = maxLevel + 1;
            }

            return(level);
        }
Пример #41
0
    void RemoveFullRows(bool[] fullRows)
    {
        Grid        grid = TileContainer.GetComponent <Grid>();
        int         row  = grid.BoardHeight - 1;
        TileManager tm   = TileContainer.GetComponent <TileManager>();

        while (row >= 0)
        {
            if (fullRows[row])
            {
                grid.ClearGridRow(row);
                tm.ClearRow(row);
            }

            row--;
        }
    }
Пример #42
0
        /**
         * Sets the tile at the given position
         * to the currently selected tile type.
         *
         * Will create the tile if one does not exist
         */
        public static void SetTile(TileManager tileManager, TileDefinition tileDefinition, int x, int y)
        {
            // Copy object to avoid dupplication between editor and tilemap
            if (tileDefinition.fixtures != null)
            {
                FixturesContainer f = (FixturesContainer)tileDefinition.fixtures.Clone();
                tileDefinition.fixtures = f;
            }

            if (tileManager.GetTile(x, y) == null)
            {
                // Create a new tile, but only if the plenum is not empty
                if (tileDefinition.plenum == null)
                {
                    return;
                }

                tileManager.EditorCreateTile(x, y, tileDefinition);
                Undo.RegisterCreatedObjectUndo(tileManager.GetTile(x, y).gameObject, "Created tile");
            }
            else
            {
                // Save old definition
                TileDefinition oldDefinition = tileManager.GetTile(x, y).Tile;
                // Copy object to avoid dupplication between editor and tilemap
                if (oldDefinition.fixtures != null)
                {
                    FixturesContainer f = (FixturesContainer)oldDefinition.fixtures.Clone();
                    oldDefinition.fixtures = f;
                }


                // Existing tile found. We try to update the non-null items in the tiledefinition
                List <TileBase> tileBases = GetTileItems(tileDefinition);
                for (int i = 0; i < tileBases.ToArray().Length; i++)
                {
                    if (tileBases[i] != null)
                    {
                        oldDefinition = SetTileItem(oldDefinition, tileBases[i], i);
                    }
                }

                Undo.RecordObject(tileManager.GetTile(x, y).gameObject, "Updated tile");
                tileManager.EditorUpdateTile(x, y, oldDefinition);
            }
        }
Пример #43
0
    private void Start()
    {
        // Afectation des positions en X
        posXPlayer1 = player1.transform.position.x;
        posXPlayer2 = player2.transform.position.x;

        // Affectation des scripts des joueurs
        p1Script = player1.GetComponent <Player>();
        p2Script = player2.GetComponent <Player>();

        // Affection des manager
        tileMScript1 = tileManager1.GetComponent <TileManager>();
        tileMScript2 = tileManager2.GetComponent <TileManager>();

        obMScript1 = obManager1.GetComponent <ObstaclesManager>();
        obMScript2 = obManager2.GetComponent <ObstaclesManager>();
    }
 // Update is called once per frame
 void Update()
 {
     // check that it is the object's turn to move
     if (CharacterManager.aTurn == 2 || CharacterManager.aTurn == 4)
     {
         // select the object only if it is not selected and no objects are in movement
         if (CharacterManager.aCurrentlySelectedUnit != gameObject && !ClickAndMove.aIsObjectMoving)
         {
             ClickAndMove.aIsObjectMoving            = true;
             CharacterManager.aCurrentlySelectedUnit = gameObject;
             TileManager.aCurrentlySelectedTile      = TileManager.pickRandomTile();
             TileManager.aSingleTileIsSelected       = true;
             charManager.SendMessage("selectUnit", gameObject);
             charManager.SendMessage("move");
         }
     }
 }
Пример #45
0
        protected override void StartDelayed(InteractionEvent interactionEvent)
        {
            TileManager    tileManager = Object.FindObjectOfType <TileManager>();
            GameObject     target      = ((IGameObjectProvider)interactionEvent.Target).GameObject;
            TileDefinition tile        = target.GetComponentInParent <TileObject>().Tile;

            if (TurfReinforceList.TryGetValue(tile.turf, out Turf turf))
            {
                tile.turf = turf;
            }
            else
            {
                tile.turf = TurfReinforceList.First(x => x.Value == tile.turf).Key;
            }

            tileManager.UpdateTile(target.transform.position, tile);
        }
Пример #46
0
        public static void DestroyAllGhosts(TileManager tileManager)
        {
#if UNITY_EDITOR
            if (!tileManager)
            {
                return;
            }

            for (int i = tileManager.transform.childCount - 1; i >= 0; --i)
            {
                if (tileManager.transform.GetChild(i).tag == "EditorOnly")
                {
                    Object.DestroyImmediate(tileManager.transform.GetChild(i).gameObject);
                }
            }
#endif
        }
Пример #47
0
    public void BreakShoji(Vector3 pos)
    {
        int x        = (int)pos.x / 10;
        int z        = (int)pos.z / 10;
        int position = z * 10 + x;

        /*Vector3 position = manager.GetComponent<MazeBuilder>().GetTile(pos).GetComponent<TileManager>().contains.gameObject.transform.position;
         * position.y = 0f;*/
        TileManager tile     = m_Tiles[position];
        Quaternion  rotation = tile.contains.gameObject.transform.rotation;

        pos.y = 0;
        GameObject brokenShoji = Instantiate(m_BrokenShoji, pos, rotation);

        Destroy(manager.GetComponent <MazeBuilder>().GetTile(pos).GetComponent <TileManager>().contains);
        manager.GetComponent <MazeBuilder>().GetTile(pos).GetComponent <TileManager>().SetContains(brokenShoji);
    }
Пример #48
0
    // Casts a ray. It returns the intersection point with a solid tile.
    public bool TileRaycast(Ray ray, float dist, out Vector2 result)
    {
        Vector2Int start = Utils.TilePos(ray.origin);
        Vector2Int end   = Utils.TilePos(ray.origin + ray.direction * dist);

        if (start.x > end.x)
        {
            int tmp = start.x;
            start.x = end.x;
            end.x   = tmp;
        }

        if (start.y > end.y)
        {
            int tmp = start.y;
            start.y = end.y;
            end.y   = tmp;
        }

        float minDistance = dist;

        for (int y = start.y; y <= end.y; y++)
        {
            for (int x = start.x; x <= end.x; x++)
            {
                Tile tile = GetTile(x, y);

                if (TileManager.GetData(tile).passable)
                {
                    continue;
                }

                float newDist = TileRayIntersection(new Vector2(x, y), ray);
                minDistance = Mathf.Min(minDistance, newDist);
            }
        }

        if (minDistance != dist)
        {
            result = ray.origin + ray.direction * minDistance;
            return(true);
        }

        result = Vector2.zero;
        return(false);
    }
Пример #49
0
 static TileEditor()
 {
     if (systemManager==null)
     {
         systemManager = GameObject.FindObjectOfType<SystemManager>();
         if (systemManager == null)
             systemManager= new GameObject("systemManager").AddComponent<SystemManager>();
         systemManager.gameObject.hideFlags = HideFlags.HideAndDontSave;
     }
     if (tileManager == null)
     {
         tileManager = GameObject.FindObjectOfType<TileManager>();
         if (tileManager == null)
             tileManager = new GameObject("tileManager").AddComponent<TileManager>();
         tileManager.gameObject.transform.SetParent(systemManager.transform);
     }
     EditorApplication.update += Update;
 }
        //800x600
        //50x37.5
        public TileLayoutDataSource(string resource, TileManager MapTiles)
        {
            pixelMultiplier = 16;
            this.MapTiles = MapTiles;
            TileList = new List<Tile>();

            datasource = resource;

            //string file = System.IO.Path.GetFileName(resource);
            FileInfo fi = new FileInfo(resource);
            OleDbConnection excelConnection = new OleDbConnection
            (@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fi.DirectoryName + ";Extended Properties=Text;");
            OleDbCommand cmd = new OleDbCommand(string.Format("SELECT * FROM [{0}]",fi.Name), excelConnection);
            OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);
            excelConnection.Open();
            data = new DataSet();
            adapter.Fill(data);
            excelConnection.Close(); excelConnection.Dispose(); excelConnection = null;
            cmd.Dispose(); cmd = null;
            adapter.Dispose(); adapter = null;
        }
Пример #51
0
    void Start()
    {
        mTileManager = gameObject.GetComponent<TileManager>();
        mTotalTileCount = mTileManager.GetTileColumnsCount();

        mFire = new bool[FIRE_COUNT];

        float bps = beatsPerMinute / 60.0f;
        mTimePerBeat = 1.0f / bps;

        //startDelay = 2;
        startDelay = ((startDelay * mTimePerBeat) * mTotalTileCount) * -1;
        mCurrentDelay = startDelay;

        mTimePerBeat /= (float)FIRE_COUNT;

        mCurrentTime = 0.0f;
        mSixteenthCount = 0;
        mCurrentTileCount = 0;

        mBeatsPerMinuteDivided = beatsPerMinute / 100.0f;
    }
Пример #52
0
    public void Init()
    {
        manager = new TileManager ();

        player = new Player ();
        player_other = new Player ();

        suburbs_description = "{\"name\": \"Suburbs\", \"triggers\": [], \"color\": \"GREEN\", \"price\": 3, \"number\": \"0\", \"immediate\": {\"resource\": \"POPULATION\", \"value\": 2}, \"letter\": \"BASE\", \"icon\": \"NONE\"}";
        park_description = "{\"name\": \"Community Park\", \"triggers\": [{\"scope\": \"ADJACENT\", \"when\": \"ALWAYS\", \"effect\": {\"resource\": \"REPUTATION\", \"value\": 1}, \"type\": \"YELLOW\"}, {\"scope\": \"ADJACENT\", \"when\": \"ALWAYS\", \"effect\": {\"resource\": \"REPUTATION\", \"value\": 1}, \"type\": \"GREEN\"}, {\"scope\": \"ADJACENT\", \"when\": \"ALWAYS\", \"effect\": {\"resource\": \"REPUTATION\", \"value\": 1}, \"type\": \"BLUE\"}], \"color\": \"GREY\", \"price\": 4, \"number\": \"0\", \"immediate\": {\"resource\": \"INCOME\", \"value\": -1}, \"letter\": \"BASE\", \"icon\": \"NONE\"}";
        factory_description = "{\"name\": \"Heavy Factory\", \"triggers\": [{\"scope\": \"ADJACENT\", \"when\": \"ALWAYS\", \"effect\": {\"resource\": \"REPUTATION\", \"value\": -1}, \"type\": \"GREY\"}, {\"scope\": \"ADJACENT\", \"when\": \"ALWAYS\", \"effect\": {\"resource\": \"REPUTATION\", \"value\": -1}, \"type\": \"GREEN\"}], \"color\": \"YELLOW\", \"price\": 3, \"number\": \"0\", \"immediate\": {\"resource\": \"INCOME\", \"value\": 1}, \"letter\": \"BASE\", \"icon\": \"NONE\"}";
        suburbs_ = GetTileFromString(suburbs_description);
        park_ = GetTileFromString(park_description);
        factory_ = GetTileFromString(factory_description);

        // We create the first three base tiles instances for both players
        suburbs = new TileInstance (suburbs_);
        suburbs.owner = player;
        park = new TileInstance (park_);
        park.owner = player;
        factory = new TileInstance (factory_);
        factory.owner = player;

        suburbs.position = new TilePosition (0, 0);
        park.position = new TilePosition (0, 2);
        factory.position = new TilePosition (0, 4);

        suburbs_other = new TileInstance (suburbs_);
        suburbs_other.owner = player_other;
        park_other = new TileInstance (park_);
        park_other.owner = player_other;
        factory_other = new TileInstance (factory_);
        factory_other.owner = player_other;

        suburbs_other.position = new TilePosition (0, 0);
        park_other.position = new TilePosition (0, 2);
        factory_other.position = new TilePosition (0, 4);
    }
Пример #53
0
 void Awake()
 {
     instance = this;
 }
Пример #54
0
 void Start()
 {
     tileManager = GameObject.FindGameObjectWithTag("Game").GetComponent<TileManager>();
     source = GetComponent<AudioSource>();
     anim = gameObject.GetComponent<Animator>();
 }
Пример #55
0
    // Use this for initialization
    void Start()
    {
        // To prevent duplicate unitManagers
        if (unitManagerRef == null)
        {
            unitManagerRef = this;
            DontDestroyOnLoad(gameObject);

            nameSelector = GetComponent<NameSelector>();
            tileManager = GetComponent<TileManager>();
            tileInfo = GameObject.Find("Tile Info");

            initGameData();   // Create or load data depending on option clicked
        }
        // Destroy duplicated gameObject created when changing scenes
        else
            DestroyImmediate(gameObject);
    }
Пример #56
0
        public override void Initialize()
        {
            string logFilename;
            string logPathSetupWarning;

            try
            {
                HandleCommandLine(Environment.GetCommandLineArgs());

                if (!Directory.Exists(SavePath))
                    Directory.CreateDirectory(SavePath);

                ConfigFile.ConfigRead += OnConfigRead;
                FileTools.SetupConfig();

                Main.ServerSideCharacter = ServerSideCharacterConfig.Enabled;

                DateTime now = DateTime.Now;
                // Log path was not already set by the command line parameter?
                if (LogPath == LogPathDefault)
                    LogPath = Config.LogPath;
                try
                {
                    logFilename = Path.Combine(LogPath, now.ToString(LogFormat) + ".log");
                    if (!Directory.Exists(LogPath))
                        Directory.CreateDirectory(LogPath);
                }
                catch (Exception ex)
                {
                    logPathSetupWarning =
                        "Could not apply the given log path / log format, defaults will be used. Exception details:\n" + ex;

                    ServerApi.LogWriter.PluginWriteLine(this, logPathSetupWarning, TraceLevel.Error);

                    // Problem with the log path or format use the default
                    logFilename = Path.Combine(LogPathDefault, now.ToString(LogFormatDefault) + ".log");
                }

                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            }
            catch (Exception ex)
            {
                // Will be handled by the server api and written to its crashlog.txt.
                throw new Exception("Fatal TShock initialization exception. See inner exception for details.", ex);
            }

            // Further exceptions are written to TShock's log from now on.
            try
            {
                if (Config.StorageType.ToLower() == "sqlite")
                {
                    string sql = Path.Combine(SavePath, "tshock.sqlite");
                    DB = new SqliteConnection(string.Format("uri=file://{0},Version=3", sql));
                }
                else if (Config.StorageType.ToLower() == "mysql")
                {
                    try
                    {
                        var hostport = Config.MySqlHost.Split(':');
                        DB = new MySqlConnection();
                        DB.ConnectionString =
                            String.Format("Server={0}; Port={1}; Database={2}; Uid={3}; Pwd={4};",
                                hostport[0],
                                hostport.Length > 1 ? hostport[1] : "3306",
                                Config.MySqlDbName,
                                Config.MySqlUsername,
                                Config.MySqlPassword
                                );
                    }
                    catch (MySqlException ex)
                    {
                        ServerApi.LogWriter.PluginWriteLine(this, ex.ToString(), TraceLevel.Error);
                        throw new Exception("MySql not setup correctly");
                    }
                }
                else
                {
                    throw new Exception("Invalid storage type");
                }

                if (Config.UseSqlLogs)
                    Log = new SqlLog(DB, logFilename, LogClear);
                else
                    Log = new TextLog(logFilename, LogClear);

                if (File.Exists(Path.Combine(SavePath, "tshock.pid")))
                {
                    Log.ConsoleInfo(
                        "TShock was improperly shut down. Please use the exit command in the future to prevent this.");
                    File.Delete(Path.Combine(SavePath, "tshock.pid"));
                }
                File.WriteAllText(Path.Combine(SavePath, "tshock.pid"),
                    Process.GetCurrentProcess().Id.ToString(CultureInfo.InvariantCulture));

                HandleCommandLinePostConfigLoad(Environment.GetCommandLineArgs());

                Backups = new BackupManager(Path.Combine(SavePath, "backups"));
                Backups.KeepFor = Config.BackupKeepFor;
                Backups.Interval = Config.BackupInterval;
                Bans = new BanManager(DB);
                Warps = new WarpManager(DB);
                Regions = new RegionManager(DB);
                Users = new UserManager(DB);
                Groups = new GroupManager(DB);
                Itembans = new ItemManager(DB);
                ProjectileBans = new ProjectileManagager(DB);
                TileBans = new TileManager(DB);
                RememberedPos = new RememberedPosManager(DB);
                CharacterDB = new CharacterManager(DB);
                RestApi = new SecureRest(Netplay.ServerIP, Config.RestApiPort);
                RestManager = new RestManager(RestApi);
                RestManager.RegisterRestfulCommands();

                var geoippath = Path.Combine(SavePath, "GeoIP.dat");
                if (Config.EnableGeoIP && File.Exists(geoippath))
                    Geo = new GeoIPCountry(geoippath);

                Log.ConsoleInfo("TShock {0} ({1}) now running.", Version, VersionCodename);

                ServerApi.Hooks.GamePostInitialize.Register(this, OnPostInit);
                ServerApi.Hooks.GameUpdate.Register(this, OnUpdate);
                ServerApi.Hooks.GameHardmodeTileUpdate.Register(this, OnHardUpdate);
                ServerApi.Hooks.GameStatueSpawn.Register(this, OnStatueSpawn);
                ServerApi.Hooks.ServerConnect.Register(this, OnConnect);
                ServerApi.Hooks.ServerJoin.Register(this, OnJoin);
                ServerApi.Hooks.ServerLeave.Register(this, OnLeave);
                ServerApi.Hooks.ServerChat.Register(this, OnChat);
                ServerApi.Hooks.ServerCommand.Register(this, ServerHooks_OnCommand);
                ServerApi.Hooks.NetGetData.Register(this, OnGetData);
                ServerApi.Hooks.NetSendData.Register(this, NetHooks_SendData);
                ServerApi.Hooks.NetGreetPlayer.Register(this, OnGreetPlayer);
                ServerApi.Hooks.NpcStrike.Register(this, NpcHooks_OnStrikeNpc);
                ServerApi.Hooks.ProjectileSetDefaults.Register(this, OnProjectileSetDefaults);
                ServerApi.Hooks.WorldStartHardMode.Register(this, OnStartHardMode);
                ServerApi.Hooks.WorldSave.Register(this, SaveManager.Instance.OnSaveWorld);
                ServerApi.Hooks.WorldChristmasCheck.Register(this, OnXmasCheck);
                ServerApi.Hooks.WorldHalloweenCheck.Register(this, OnHalloweenCheck);
                ServerApi.Hooks.NetNameCollision.Register(this, NetHooks_NameCollision);
                Hooks.PlayerHooks.PlayerPreLogin += OnPlayerPreLogin;
                Hooks.PlayerHooks.PlayerPostLogin += OnPlayerLogin;
                Hooks.AccountHooks.AccountDelete += OnAccountDelete;
                Hooks.AccountHooks.AccountCreate += OnAccountCreate;

                GetDataHandlers.InitGetDataHandler();
                Commands.InitCommands();

                if (Config.RestApiEnabled)
                    RestApi.Start();

                if (Config.BufferPackets)
                    PacketBuffer = new PacketBufferer(this);

                Log.ConsoleInfo("AutoSave " + (Config.AutoSave ? "Enabled" : "Disabled"));
                Log.ConsoleInfo("Backups " + (Backups.Interval > 0 ? "Enabled" : "Disabled"));

                if (Initialized != null)
                    Initialized();

                Log.ConsoleInfo("Welcome to TShock for Terraria. Initialization complete.");
            }
            catch (Exception ex)
            {
                Log.Error("Fatal Startup Exception");
                Log.Error(ex.ToString());
                Environment.Exit(1);
            }
        }
Пример #57
0
	public void Awake () {
		if (debugBuild)
			BuildDifficulty (debugDifficulty);
		if (manager == null)
			manager = gameObject.GetComponent<TileManager>();
	}
Пример #58
0
    // Use this for initialization
    void Start()
    {
        player = GetComponent<Player>();
        m_power = GetComponent<PowerManager>();
        m_tiles = GameObject.FindGameObjectWithTag("GameController").GetComponent<TileManager>();
        m_units = GameObject.FindGameObjectWithTag("GameController").GetComponent<UnitManager>();
        m_hud = GameObject.FindGameObjectWithTag("GameController").GetComponent<HUDManager>();

        tilesInPower = new List<Tile>();
        unitsInPower = new List<Unit>();
    }
Пример #59
0
 // Sets up the building
 public void SetUp(TileManager o, string t)
 {
     outside = o;
     tag = t;
     owners = new List<NPC>();
 }
Пример #60
0
    void Awake()
    {
        archManager = GameObject.Find ("ArchManager").GetComponent<ArchManager>();
        tileManager = GameObject.Find ("TileManager").GetComponent<TileManager>();

        sourceA = GameObject.Find ("SourceA");
        sourceB = GameObject.Find ("SourceB");
        topRootA = GameObject.Find ("TopRootA");
        topRootB = GameObject.Find ("TopRootB");
        bottomRootA = GameObject.Find ("BottomRootA");
        bottomRootB = GameObject.Find ("BottomRootB");

        sourceAttrA = sourceA.GetComponent<SourceAttributes>();
        sourceAttrB = sourceB.GetComponent<SourceAttributes>();
        topRootAttrA = topRootA.GetComponent<RootAttributes>();
        topRootAttrB = topRootB.GetComponent<RootAttributes>();
        bottomRootAttrA = bottomRootA.GetComponent<RootAttributes>();
        bottomRootAttrB = bottomRootB.GetComponent<RootAttributes>();

        energyA = maxEnergy;
        energyB = maxEnergy;
    }