void checkClickedTarget(RaycastResult result) { if (result.gameObject.tag == "Enemy") { //To do : damage enemy here EnemyBattle enemyBattle = result.gameObject.GetComponent <EnemyBattle>(); enemyBattle.TakeDamage(playerStats.GetDmg()); playerBattle.GetActionBar().value = 0.0f; if (animator != null) { animator.SetTrigger("Attack"); Debug.Log("AnimAtk"); } TargetSelection = false; AttackList.SetActive(false); gameObject.SetActive(false); playerBattle.SetCharSelect(false); } else if (result.gameObject.layer == 8)//Character Layer { AttackList.SetActive(false); TargetSelection = false; } }
public override void CardEffect(PlayerBattle player, EnemyBattle enemy) { enemy.health -= 1; if (enemy.health < 0) { enemy.health = 0; } }
public void enterBattle(EnemyBattle enemy) { //battleController.player = player; aud.Pause(); player.gameObject.transform.LookAt(enemy.gameObject.transform.position, Vector3.up); battleController.enemy = enemy; BattleBlock.SetActive(true); //Debug.Log("tests"); //battleController.enabled = true; inCombat = true; }
public void Cast(PlayerBattle p, EnemyBattle e) { if (type == Type.Attack) { CastAttack(e); } else if (type == Type.Heal) { CastHeal(p); } else if (type == Type.Weak) { CastWeak(e); } }
// Use this for initialization void Start() { enemyBattle = FindObjectOfType <EnemyBattle>(); atbText = GameObject.Find("ATBGauge").GetComponent <Text>(); hpText = GameObject.Find("HPGauge").GetComponent <Text>(); healthTransform = GameObject.Find("HPBar").GetComponent <RectTransform>(); atbTransform = GameObject.Find("ATBBar").GetComponent <RectTransform>(); currentATB = maxATB; currentHealth = maxHealth; //Healthbar stuff yPosHP = healthTransform.position.y; maxXPosHP = healthTransform.position.x; //ATB stuff yPosATB = atbTransform.position.y; maxXPosATB = atbTransform.position.x; }
// Use this for initialization void Start() { enemyBattle = FindObjectOfType<EnemyBattle>(); atbText = GameObject.Find("ATBGauge").GetComponent<Text>(); hpText = GameObject.Find("HPGauge").GetComponent<Text>(); healthTransform = GameObject.Find("HPBar").GetComponent<RectTransform>(); atbTransform = GameObject.Find("ATBBar").GetComponent<RectTransform>(); currentATB = maxATB; currentHealth = maxHealth; //Healthbar stuff yPosHP = healthTransform.position.y; maxXPosHP = healthTransform.position.x; //ATB stuff yPosATB = atbTransform.position.y; maxXPosATB = atbTransform.position.x; }
private void CheckObstacle(Vector3 newPos) { //Check for enemies enemyTile = enemy.GetTile(enemy.WorldToCell(newPos)); enemyPos = newPos; if (enemyTile != null) { //Enemy encounter, create a Battle instance PlayerBattle player = this.gameObject.GetComponent <PlayerBattle>(); EnemyBattle enemy = new EnemyBattle(); battle = this.gameObject.AddComponent <BattleHandler>(); battle.player = player; battle.enemy = enemy; battle.enemy.pos = enemyPos; return; } //Check for obstacles foreach (Tilemap map in obstacles) { TileBase obstacleTile = map.GetTile(map.WorldToCell(newPos)); if (obstacleTile != null) { // There is an obstacle in the way return; } } //Check for walkable ground foreach (Tilemap map in ground) { TileBase groundTile = map.GetTile(map.WorldToCell(newPos)); if (groundTile != null) { //We can finally move pos = newPos; } } }
public void TamaraAttack(EnemyBattle enemy) { //animate playerSprite //heal one player }
public void DoraAttack(EnemyBattle enemy) { //animate playerSprite //reduce enemy health by attack points OR 30% chance of critical damage (gradual reduction) }
public void ViktoriaAttack(EnemyBattle enemy) { //animate playerSprite //reduce enemy health by attack points (gradual reduction) }
//public Text enemyHealth; public BattleHandler(PlayerBattle player, EnemyBattle enemy) { this.player = player; this.enemy = enemy; }
public override void CardEffect(PlayerBattle player, EnemyBattle enemy) { player.shield += 4; }
public abstract void CardEffect(PlayerBattle player, EnemyBattle enemy);
private void CastWeak(EnemyBattle e) { e.applyWeakness(spellValue); Instantiate(vsf, e.gameObject.transform.position, e.gameObject.transform.rotation); }
private void CastAttack(EnemyBattle e) { e.takeDamage(spellValue); Instantiate(vsf, e.gameObject.transform.position, e.gameObject.transform.rotation); }
void Awake() { enemyBattle = GetComponent <EnemyBattle>(); anim = GetComponent <Animator> (); timer = timeBetweenAttacks; }