Beispiel #1
0
 // Use this for initialization
 void Start()
 {
     enemy_behaviour = GetComponentInParent <Enemy_Behaviour>();
     animator        = GetComponent <Animator>();
     //animator.Play("IdleFront");
     //prev_state = Enemy_state.E_IDLE;
 }
 public void Cycle()
 {
     if (enemy_contained != null)
     {
         enemy = enemy_contained.GetComponent <Enemy_Behaviour>();
         enemy.Cycle();
     }
 }
Beispiel #3
0
    public void ChallengePlayer(Enemy_Behaviour enemy)
    {
        int inc_damage   = enemy.damage;
        int given_damage = (int)playerstats.Firepower / 5;

        player.GetComponent <PlayerBehav>().RecieveDamage(-(inc_damage - (int)playerstats.Endurance / 5));
        enemy.RecieveDamage(given_damage);
    }
Beispiel #4
0
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        flightHeight = Camera.main.ViewportToWorldPoint(new Vector3(0, 1, 0)).y - 4f; //highest possible height
        playerPos    = GameObject.FindGameObjectWithTag("Player").transform;
        rb           = animator.GetComponent <Rigidbody2D>();
        eb           = animator.GetComponent <Enemy_Behaviour>();

        //nextTiredTime = Time.time + getTiredAfter;
        nextShootTime   = Time.time + (1f / shootRate);
        rb.gravityScale = 0f;
    }
Beispiel #5
0
    public void removeHimselfFromTarget()
    {
        gameObject.SetActive(false);         //disabilita questo gameobject

        foreach (GameObject robot in robots) //per ogni robot nell'area (quindi quelli nella lista)...
        {
            Enemy_Behaviour enemyScript = robot.GetComponent <Enemy_Behaviour>();
            GameObject      enemyTarget = enemyScript.shootingTarget;
            if (this.gameObject == enemyTarget)
            {
                Debug.Log("rimosso dal target nemico");
                enemyTarget = null;
                enemyScript.SetDestination();
            }
        }

        robots.Clear();     //rimuovi dalla lista tutti i robot salvati
    }
 private void Awake()
 {
     enemyParent = GetComponentInParent <Enemy_Behaviour>();
     anim        = GetComponentInParent <Animator>();
 }
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     playerPos     = GameObject.FindGameObjectWithTag("Player").transform;
     eb            = animator.GetComponent <Enemy_Behaviour>();
     nextShootTime = Time.time + (1f / shootRate);
 }
Beispiel #8
0
    public void Attack(Enemy_Behaviour enemy)
    {
        int given_damage = (int)playerstats.Firepower / 5;

        enemy.RecieveDamage(given_damage);
    }