private void Awake() { meshRenderer = GetComponent <MeshRenderer>(); gridCombatSystem = GameObject.FindGameObjectWithTag("CombatHandler").GetComponent <GridCombatSystem>(); mesh = new Mesh(); GetComponent <MeshFilter>().mesh = mesh; mat = GetComponent <MeshRenderer>().material; texture = mat.mainTexture; float textureWidth = texture.width; float textureHeight = texture.height; uvCoordsDictionary = new Dictionary <MovementTilemap.TilemapObject.TilemapSprite, UVCoords>(); foreach (TilemapSpriteUV tilemapSpriteUV in tilemapSpriteUVArray) { uvCoordsDictionary[tilemapSpriteUV.tilemapSprite] = new UVCoords { uv00 = new Vector2(tilemapSpriteUV.uv00Pixels.x / textureWidth, tilemapSpriteUV.uv00Pixels.y / textureHeight), uv11 = new Vector2(tilemapSpriteUV.uv11Pixels.x / textureWidth, tilemapSpriteUV.uv11Pixels.y / textureHeight), }; } }
void Start() { Instance = this; debugS = debug; grid = new GridComplete(10, 20, 1f, new Vector3(-13, -6), debug); grid.SetUnwalkable(unWalkableCells); pathAndRadiousVisualiation = GetComponent <VisualiationHandler>(); currentState = State.playerRound; OnStateChange += HandleStateChange; SetUp(); UpdateObjectsInCellRefrences(); SetUpOnGridReady(); }
private void Awake() { _healthbar = GetComponentInChildren <HealthBar>(); _gridCombatSystem = GameObject.Find("GridCombatSystem").GetComponent <GridCombatSystem>(); _state = State.Normal; _isUnitActive = false; if (unitStats == null) { return; } _healthSystem = new HealthSystem(unitStats.maxHealth); _healthbar.Init(_healthSystem); _sr = GetComponent <SpriteRenderer>(); _sr.sprite = unitStats.sprite; _grid = GameController_GridCombatSystem.Instance.GetGrid(); }
private void Awake() { isOverloaded = false; healthBar = GetComponentInChildren <HealthBar>(); characterPrefs = GetComponent <CHARACTER_PREFS>(); selectedGameObject = transform.Find("SelectedArrow").gameObject; characterManager = GameObject.FindGameObjectWithTag("characterManager").GetComponent <CHARACTER_MNG>(); SetHealth(); healthSystem = new HealthSystem(maxHealth); curHealth = maxHealth; healthBar.SetMaxHealth(maxHealth); healthBar.SetHealth(curHealth); healthBar.SetHealthNumber(curHealth); movePosition = GetComponent <MovePositionPathfinding>(); sceneCombatSystem = GameObject.FindWithTag("CombatHandler").GetComponent <GridCombatSystem>(); }
private void Start() { gridCombatSystem = GameObject.FindGameObjectWithTag("CombatHandler").GetComponent <GridCombatSystem>(); StartFirstPartTutorial(); }