//Start // Use this for initialization void Start() { gameState = GameState.Overworld; randomEcountersOn = true;//Depending on the area. Maybe a scene database indicating whether true or false?. //Initialization of Objects cam_T = GameObject.FindGameObjectWithTag("CamTarget").GetComponent <Transform>(); playerController = GameObject.FindGameObjectWithTag("Player").GetComponent <OWPlayerController>(); battleUI = GameObject.FindGameObjectWithTag("UI").GetComponent <BattleUI>(); soundPlayer = gameObject.GetComponent <SoundPlayer>(); tileScript = GameObject.FindGameObjectWithTag("TileManager").GetComponent <TileScript>(); tileScript.Init(); battlefield = GameObject.FindGameObjectWithTag("Battlefield").GetComponent <Transform>(); //Databases. charStats = GetComponent <CharacterStats>(); attackInfo = GetComponent <AttackInfoManager>(); //General Info //Placeholder Character Creation charStats.CreateCharacterStats("Player", 0, 1, 10, 12, 5, 3, 2, 4); //PLACHEOLDER; charStats.SetTileOccupied("Player", 0, new Vector2(3, 4), tileScript.yTiles); charStats.CreateCharacterStats("Enemy", 0, 4, 70, 12, 5, 3, 2, 4); //PLACHEOLDER; charStats.SetTileOccupied("Enemy", 0, new Vector2(2, 2), tileScript.yTiles); //Create a cursor for Formation Movement GameObject objCursor; objCursor = Instantiate(cursor); selectedTileIndicator = objCursor.GetComponent <Transform>(); selectedTileIndicator.gameObject.SetActive(false); //For Movement Limit calculations tileVectorSize.x = tileScript.xTiles; tileVectorSize.y = tileScript.yTiles; tileAmount = tileScript.tileAmount - 1; selectionLimit[0] = new Vector2(tileVectorSize.x / 2, 0); selectionLimit[1] = new Vector2(tileVectorSize.x, tileVectorSize.y); selectionLimit[2] = new Vector2(0, 0); selectionLimit[3] = new Vector2(tileVectorSize.x / 2, tileVectorSize.y); //MoveFormation(0, charControl[0].tile); //PLACEHOLDER battleUI.Init(); }
public void Init(int charID, bool isPlayer) { if (isPlayer) { alliance = 0; allianceString = "Player"; } else { alliance = 1; allianceString = "Enemy"; } level = PlayerPrefs.GetInt(allianceString + charID + "Level"); hp = PlayerPrefs.GetInt(allianceString + charID + "Hp"); mp = PlayerPrefs.GetInt(allianceString + charID + "Mp"); atk = PlayerPrefs.GetInt(allianceString + charID + "Attack"); def = PlayerPrefs.GetInt(allianceString + charID + "Defense"); res = PlayerPrefs.GetInt(allianceString + charID + "Resistance"); spd = PlayerPrefs.GetInt(allianceString + charID + "Speed"); currentHp = PlayerPrefs.GetInt(allianceString + charID + "Current Hp"); currentMp = PlayerPrefs.GetInt(allianceString + charID + "Current Mp"); if (currentHp > hp) { currentHp = hp; } if (currentMp > mp) { currentMp = mp; } attackInfo = GameObject.FindGameObjectWithTag("Manager").GetComponent <AttackInfoManager>(); CalculateAttackNumber(charID); tile.x = PlayerPrefs.GetFloat(allianceString + charID + "_TileX"); tile.y = PlayerPrefs.GetFloat(allianceString + charID + "_TileY"); tileID = Mathf.FloorToInt(tile.y + tile.x * rowSize); //transform.position = }