Exemplo n.º 1
0
 void Start()
 {
     agent  = GetComponent <NavMeshAgent>();
     player = Player.instance.transform;
     //Get Enemy and EnemyController if AI is an enemy
     if (isEnemy)
     {
         if (this.tag == "Enemy")
         {
             enemyController = GetComponent <EnemyController>();
             enemy           = GetComponent <Enemy>();
         }
         else if (this.tag == "EnemyArcher")
         {
             enemyArcherController  = GetComponent <EnemyArcherController>();
             enemyArcher            = GetComponent <EnemyArcher>();
             agent.stoppingDistance = 1.0f;
         }
     }
     catmull = new CatmullRom(ctl);
     u       = 0f;
 }
Exemplo n.º 2
0
 public Archer_IdleState(EntityNPC entity, FiniteStateMachine stateMachine, string animBoolName, D_IdleState stateData, EnemyArcher enemy) : base(entity, stateMachine, animBoolName, stateData)
 {
     this.enemy = enemy;
 }
 public Archer_LookForPlayerState(EntityNPC entity, FiniteStateMachine stateMachine, string animBoolName, D_LookForPlayerState stateDate, EnemyArcher enemy) : base(entity, stateMachine, animBoolName, stateDate)
 {
     this.enemy = enemy;
 }
Exemplo n.º 4
0
    /*
     * Detects a collision between two coliders and acts accordingly
     * Parameters: other - collider that hit the target
     * Creator: Kevin Ho, Myles Hagen, SHane Weerasuriya
     */
    void OnTriggerEnter(Collider other)
    {
        //Enemy hit player
        //if (other.tag == "Player"){
        //Debug.Log("ATTACK HIT Player!");
        //}
        //Player hit enemy
        //if (other.tag == "Enemy"){
        //Debug.Log("ATTACK HIT ENEMY:" + other.gameObject.name);
        //}
        //Player attack hit enemy
        if ((other.tag == "PlayerAttack") && (tag != "Player"))
        {
            //Debug.Log("PLAYER ATTACK HIT " + this.name + ": " + other.gameObject.name);
            if (tag == "DestructableObject")
            {
                GetComponent <Destructable>().DestroyObject();
            }
            //Get stats of the enemy
            else if (tag == "EnemyArcher")
            {
                enemyArcher = GetComponent <EnemyArcher>();
                enemyStats  = enemyArcher.getMyStats();
            }
            else
            {
                enemy      = GetComponent <Enemy>();
                enemyStats = enemy.getMyStats();
            }

            //Debug.Log("Enemy Attack: " + enemyStats.damage.GetValue());

            //Get stats of the player and deal damage
            //CharacterCombat playerCombat = playerManager.player.GetComponent<CharacterCombat> ();
            CharacterCombat playerCombat = Player.instance.playerCombatManager;
            //Debug.Log(other.name);
            if (other.name == "AOE Attack hitbox (Effect test)(Clone)")
            {
                playerCombat.AOESkillAttack(enemyStats);
            }

            else if (other.name == "Dash Attack Hitbox(Clone)")
            {
                playerCombat.DashSkillAttack(enemyStats);
            }

            else if (other.name == "Debuff Attack Hitbox(Clone)")
            {
                originalDebuffValue          = enemyStats.damage.baseValue;
                enemyStats.damage.baseValue -= playerMotor.debuffValue;

                //Coroutine to remove debuff
                StartCoroutine(removeDebuff(playerMotor.debuffAttackDestroy));
            }

            else
            {
                playerCombat.ProjSkillAttack(enemyStats);
            }

            // CharacterCombat playerCombat = Player.instance.playerCombatManager; // use new Player script rather than playerManager

            return;
        }
        //Enemy Archer hit player
        if ((other.tag == "EnemyArcherAttack") && (tag == "Player"))
        {
            //Debug.Log("ENEMY ARCHER HIT " + this.name + ": " + other.gameObject.name);
            PlayerStats playerStats = Player.instance.playerStats;
            playerStats.TakeDamage(5);
            return;
        }
        //Enemy Mage hit player
        if ((other.tag == "EnemyMageAttack") && (tag == "Player"))
        {
            //Debug.Log("ENEMY MAGE HIT " + this.name + ": " + other.gameObject.name);
            PlayerStats playerStats = Player.instance.playerStats;
            playerStats.TakeDamage(5);
            return;
        }
    }