public override void UnloadContent() { base.UnloadContent(); _MapManager = null; testGuy = null; rectList = null; }
public override void load() { TilemapManager.load(); Terrain.load(); Biomes.BiomeSpawn.load(); Plants.PlantSpawn.load(); }
public MapNode(int x1, int y1, int x2, int y2, TilemapManager tilemapManager) { startX = x1; startY = y1; endX = x2; endY = y2; blockConnections = new List <Vector2Int>(); connections = new List <Connection>(); if (x2 + 1 < mapSize) { for (int y = y1; y <= y2; y++) { ConnectToBlock(x2 + 1, y, true, tilemapManager); } } if (y2 + 1 < mapSize) { for (int x = x1; x <= x2; x++) { ConnectToBlock(x, y2 + 1, false, tilemapManager); } } centerX = (startX * (blockSize + blockGap) + endX * (blockSize + blockGap) + blockSize) / 2; centerY = (startY * (blockSize + blockGap) + endY * (blockSize + blockGap) + blockSize) / 2; }
public override void LoadContent() { base.LoadContent(); _MapManager = new TilemapManager(); _MapManager.LoadMap("ProtoLevel", _Content); rectTex = _Content.Load <Texture2D>(@"Art/edgeTex"); }
void Start() { paintballColor = (EColor)Random.Range(0, System.Enum.GetValues(typeof(EColor)).Length - 1); sprite.color = GameManager.instance.attribution.allColors[(int)paintballColor]; manager = GameObject.Find("Map").GetComponent <TilemapManager> ( ); Destroy(this.gameObject, 5.0f); }
void Awake() { if (instance == null) { instance = this; } }
void Start() { isWorldReady = GameObject.Find("TileMap").GetComponent <TilemapManager>().worldGenerated; this.tileSize = GameObject.Find("NoiseGenerator").GetComponent <ElevationNoise>().tileSize; tilemapManager = GameObject.Find("TileMap").GetComponent <TilemapManager>(); pathfinder = GetComponent <Pathfinding>(); }
void Awake() { cam = Camera.main; player = GameObject.FindWithTag("Player").transform; uiManager = GetComponent <UIManager>(); clickManager = GetComponent <ClickManager>(); playerMovement = GetComponent <PlayerMovement>(); dialogueManager = GetComponent <DialogueManager>(); questManager = GetComponent <QuestManager>(); tilemapManager = GetComponent <TilemapManager>(); //Loading stats if (SaveManager.Load <PlayerStats>() != null && !doesStartFresh) { stats = SaveManager.Load <PlayerStats>(); } else { stats = new PlayerStats(); SaveManager.Save(stats); } //Load Inventory //inv = new Inventory(); inv = new Inventory(); debug = stats; }
public Connection(MapNode origin, int endX, int endY, bool isSideConnection, TilemapManager tilemapManager) { // coords to the middle of the block it's connecting to int middleX = endX * (blockSize + blockGap) + blockSize / 2 + 1; int middleY = endY * (blockSize + blockGap) + blockSize / 2 + 1; int edgeX = origin.endX * (blockSize + blockGap) + blockSize; int edgeY = origin.endY * (blockSize + blockGap) + blockSize; GraphNode node1 = tilemapManager.graph[0]; GraphNode node2 = tilemapManager.graph[0]; if (isSideConnection) { bridgeStart = new Vector2Int(edgeX, middleY); bridgeEnd = new Vector2Int(edgeX + blockGap + 1, middleY); node1 = tilemapManager.graph[(origin.endX + endY * mapSize) * 4 + 1]; node2 = tilemapManager.graph[(origin.endX + 1 + endY * mapSize) * 4 + 3]; } else { bridgeStart = new Vector2Int(middleX, edgeY); bridgeEnd = new Vector2Int(middleX, edgeY + blockGap + 1); node1 = tilemapManager.graph[(endX + origin.endY * mapSize) * 4 + 2]; node2 = tilemapManager.graph[(endX + (origin.endY + 1) * mapSize) * 4]; } node1.connections.Add(node2); node2.connections.Add(node1); }
public World() { TilemapManager.initialize(); Terrain.initialize(); Biomes.BiomeSpawn.initialize(); Plants.PlantSpawn.initialize(); }
void Awake() { _tilemapManager = gfm.tilemapManager; _pathfind = new Pathfind { tilemapManager = _tilemapManager }; _agent = GetComponent <Agent>(); }
public void reload(Vector2Int new_center) { TilemapManager.reload(new_center); Terrain.reload(); Biomes.BiomeSpawn.reload(); Plants.PlantSpawn.reload(); render(); }
public ActivePlayableState(ActorFacade actor) { this.actor = actor; this.combatActionsMapping = DependencyLocator.GetActionsMapper <CombatActionsMapping>(); this.skillQueueResolver = DependencyLocator.GetSkillQueueResolver(); this.tilemapManager = DependencyLocator.getTilemapManager(); }
private void Start() { monsterManager = FindObjectOfType <MonsterManager>(); cameraManager = FindObjectOfType <CameraManager>(); camera = FindObjectOfType <Camera>(); tileMapManager = FindObjectOfType <TilemapManager>(); turrets = new List <Turret>(); }
public static Finder <TileFacade> getTileFinder() { if (instance.tileFinder == null) { TilemapManager tilemap = DependencyLocator.getTilemapManager(); instance.tileFinder = new Finder <TileFacade>(tilemap.TilesMap); } return(instance.tileFinder); }
public void Start( ) { if (parent != null) { manager = GameObject.Find("Map").GetComponent <TilemapManager> ( ); playerColor = parent.Color; ResetPaintball( ); } }
public CombatGameState(GameStateMachine gameStateMachine) { this.gameStateMachine = gameStateMachine; this.tilemapManager = DependencyLocator.getTilemapManager(); this.timelineController = DependencyLocator.getTimelineController(); this.skillQueueResolver = DependencyLocator.GetSkillQueueResolver(); this.combatActionsMapping = DependencyLocator.GetActionsMapper <CombatActionsMapping>(); this.spawner = DependencyLocator.GetSpawner(); }
public override void UnloadContent() { base.UnloadContent(); _MapManager = null; path = null; TileOne = null; TileTwo = null; rectTex = null; tileRect = Rectangle.Empty; }
public void InitCreatorAndMover(Tilemap tilemap, MapDimentions mapDimentions) { this.mapDimentions = mapDimentions; this.tilemap = tilemap; tilemapManager = tilemap.GetComponent <TilemapManager>(); this.mapInfo = tilemap.GetComponent <Match3TileMapInformation>(); this.mapInfo.InitMapToCreateAndMove(new Vector3Int(0, 0, 0), tilemap, mapDimentions, tiles); tilemapManager.StartCoroutine(ChangeObliqueMoveDirection()); }
// 階数を指定してフロア呼び出し&開始 public static void SetFloor(int floorNum) { if (floorNum <= 0 || floorNum > CurrentDungeon.MaxFloorNum) { Debug.LogError("階数が不正です。入力された階数:" + floorNum); } CurrentFloor = CurrentDungeon.MakeFloor(floorNum, GetPlayer); TilemapManager.GenerateFloor(CurrentFloor.Terrains); Instance.turnManager = new TurnManager(CurrentFloor); Instance.turnManager.SetTurnLoop(); }
public NPCManager(TileMaps.TilemapManager tMapManager, ContentManager content, GameObjects.Player player, DialogManager dm, InventoryManager im, WorldObjectManager wom) { _SpriteListActive = new List <NPC>(); _SpriteListDead = new List <NPC>(); _ProjectileList = new List <Projectile>(); _TilemapManager = tMapManager; _DialogManager = dm; _Content = content; _InventoryManager = im; _WorldObjectManager = wom; thePlayer = player; }
public override void OnInspectorGUI() { DrawDefaultInspector(); TilemapManager myScript = target as TilemapManager; if (myScript.tileSize.x == 0.0f) { myScript.tileSize.x = 1.0f; } if (myScript.tileSize.y == 0.0f) { myScript.tileSize.y = 1.0f; } GUILayout.Space(20); if (GUILayout.Button("Gerar")) { myScript.GenerateTiles(); } GUILayout.BeginHorizontal(); nomeArquivo = GUILayout.TextField(nomeArquivo); if (GUILayout.Button("Salvar")) { myScript.SaveToFile(Application.dataPath + "/Mapas/" + nomeArquivo + ".czm"); } if (GUILayout.Button("Carregar")) { myScript.LoadFromFile(Application.dataPath + "/Mapas/" + nomeArquivo + ".czm"); } GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.BeginHorizontal(); GUILayout.Label("Selecionado: " + (selected != -1 ? myScript.tiles [selected].name : "None")); string[] ops = new string[myScript.tiles.Length]; for (int i = 0; i < ops.Length; i++) { ops[i] = myScript.tiles[i].name; } selected = EditorGUILayout.Popup(selected, ops); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Ferramenta selecionada:"); if (GUILayout.Button(delete ? "Apagar" : "Pintar")) { delete = !delete; } GUILayout.EndHorizontal(); }
public override void LoadContent() { base.LoadContent(); rectList = new List <Rectangle>(); testGuy = new Player(); testGuy.LoadContent(@"Art/Player", _Content); testGuy._Position = new Vector2(200, 0); _MapManager = new TilemapManager(); _MapManager.LoadMap("MegaLevel", _Content); LoadCollision(_MapManager.findMapByName("MegaLevel")); }
private void Awake() { if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(gameObject); return; } _platforms = new List <PlatformMovement>(); }
public void onNotify(Notifications notification, List <object> data) { switch (notification) { case PLAYER_POS_CHANGED: Vector2Int new_pos = (Vector2Int)data[0]; if (TilemapManager.checkPlayerPosition(new_pos)) { notify(FREEZE_PLAYER_RB, null); reload(new_pos); notify(UNFREEZE_PLAYER_RB, null); } break; } }
// Use this for initialization void Start() { maps = TilemapManager.GetMaps(Application.dataPath + "/Mapas/"); if (text != null) { curr = 0; if (maps.Length > 0) { text.text = maps [0]; } else { text.text = "NO MAPS FOUND!"; } } }
//Add all players if players.count equals to zero then call setStray if player not equal to owner public override void UsingItem( ) { Vector3 setPos = new Vector3(); switch (bombState) { //get tilemapmanager and also set position and enable collider trigger and renderer then set state to WAITTING case ART_BOMB_STATE.BEFORE_SETTING: if (Owner.IsPlayerOnGround) { bombState = ART_BOMB_STATE.SETTING; } else { state = EItemState.PICK_UP; } break; case ART_BOMB_STATE.SETTING: if (tilemapManager == null) { tilemapManager = GameObject.Find("Map").GetComponent <TilemapManager> ( ); } transform.position = Owner.transform.position; setPos = Owner.transform.position; col.enabled = false; trigger.enabled = true; rend.enabled = true; bombState = ART_BOMB_STATE.WAITING; break; //keep wait for other player to enter trigger area case ART_BOMB_STATE.WAITING: transform.position = setPos; break; //after bombing reset art bomb case ART_BOMB_STATE.BOMBING: BeforeEndState( ); break; } }
// Update is called once per frame void Update() { if (!active) { anim.SetBool("Walking", false); return; } anim.SetBool("Walking", Mathf.Abs(Input.GetAxis("Horizontal")) > 0.2f); transform.Translate(Vector2.right * Input.GetAxis("Horizontal") * Time.deltaTime * speed); pawHitCooldownTimer -= Time.deltaTime; if (Mathf.Abs(Input.GetAxis("Horizontal")) > 0.2f) { transform.localScale = new Vector3((Input.GetAxis("Horizontal") < 0) ? 1 : -1, 1f, 1f); } if (Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.Z) || Input.GetKey(KeyCode.W)) { if (CanJump()) { Jump(); } } if (Input.GetKey(KeyCode.Space) || Input.GetKey(KeyCode.X) || Input.GetKey(KeyCode.F)) { if (pawHitCooldownTimer <= 0f) { pawHitCooldownTimer = pawHitCooldown; foreach (Collider2D other in Physics2D.OverlapCircleAll(paw.transform.position, pawSize)) { if (other.transform.tag == "Movable") { TilemapManager tmm = other.transform.parent.GetComponent <TilemapManager>(); Vector2Int boxPos = tmm.GetTilePosFromTransformPos(other.transform.position); if (tmm.GetTilemap().PushBox(boxPos.x, boxPos.y, other.transform.position.x > transform.position.x)) { GetComponent <AudioSource> ().clip = moveSound; GetComponent <AudioSource> ().Play(); } break; } } } } }
private void Start() { mRigidbody2D = GetComponent <Rigidbody2D>(); mAnimator = GetComponent <Animator>(); controller = GetComponent <CharacterController2D>(); lineRenderer = GetComponentInChildren <LineRenderer>(); cam = Camera.main; effectHandler = EffectHandler.Instance; tileManager = TilemapManager.Instance; spawner = EnemySpawner.Instance; statsManager = StatsManager.Instance; timeLeft = weapon.timeBetweenShoots; gravityScale = mRigidbody2D.gravityScale; mAnimator.SetFloat("shootSpeed", weapon.timeBetweenShoots * 5); Cursor.visible = false; startHealthBarColor = healthBar.color; healthBar.fillAmount = Health; coinsText.text = Coins.ToString(); pointsBar.fillAmount = Points; }
private void Awake() { if (current == null) { current = this; DontDestroyOnLoad(gameObject); } else { DestroyImmediate(gameObject); return; } // If the grid or tilemap are not set, find the correct gameobjects. if (!grid) { grid = GameObject.Find("Grid-" + currentActiveScene.Value).GetComponent <Grid>(); } if (!tilemap) { tilemap = GameObject.Find("Tilemap-" + currentActiveScene.Value).GetComponent <Tilemap>(); } lastActiveScene = currentActiveScene.Value; }