Exemplo n.º 1
0
    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;
        }
    }
Exemplo n.º 2
0
 public override void CardEffect(PlayerBattle player, EnemyBattle enemy)
 {
     enemy.health -= 1;
     if (enemy.health < 0)
     {
         enemy.health = 0;
     }
 }
Exemplo n.º 3
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);
     }
 }
Exemplo n.º 5
0
    // 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;
    }
Exemplo n.º 6
0
    // 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;
    }
Exemplo n.º 7
0
    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;
            }
        }
    }
Exemplo n.º 8
0
 public void TamaraAttack(EnemyBattle enemy)
 {
     //animate playerSprite
     //heal one player
 }
Exemplo n.º 9
0
 public void DoraAttack(EnemyBattle enemy)
 {
     //animate playerSprite
     //reduce enemy health by attack points OR 30% chance of critical damage (gradual reduction)
 }
Exemplo n.º 10
0
 public void ViktoriaAttack(EnemyBattle enemy)
 {
     //animate playerSprite
     //reduce enemy health by attack points (gradual reduction)
 }
Exemplo n.º 11
0
    //public Text enemyHealth;

    public BattleHandler(PlayerBattle player, EnemyBattle enemy)
    {
        this.player = player;
        this.enemy  = enemy;
    }
Exemplo n.º 12
0
 public override void CardEffect(PlayerBattle player, EnemyBattle enemy)
 {
     player.shield += 4;
 }
Exemplo n.º 13
0
 public abstract void CardEffect(PlayerBattle player, EnemyBattle enemy);
Exemplo n.º 14
0
 private void CastWeak(EnemyBattle e)
 {
     e.applyWeakness(spellValue);
     Instantiate(vsf, e.gameObject.transform.position, e.gameObject.transform.rotation);
 }
Exemplo n.º 15
0
 private void CastAttack(EnemyBattle e)
 {
     e.takeDamage(spellValue);
     Instantiate(vsf, e.gameObject.transform.position, e.gameObject.transform.rotation);
 }
Exemplo n.º 16
0
 void Awake()
 {
     enemyBattle = GetComponent <EnemyBattle>();
     anim        = GetComponent <Animator> ();
     timer       = timeBetweenAttacks;
 }