Ejemplo n.º 1
0
 // Start is called before the first frame update
 void Start()
 {
     startTime     = -20.0f;
     player        = GameObject.Find("player").transform;
     simpleScript  = gameObject.GetComponent <simple_enemy>();
     inicialHealth = simpleScript.health;
 }
Ejemplo n.º 2
0
    void Awake()
    {
        player = GameObject.Find("player").transform;

        enemyScript    = gameObject.GetComponent <simple_enemy>();
        enemyScriptHit = gameObject.GetComponent <enemyMeleeR>();

        GameObject newEmptyGO = new GameObject();

        target = newEmptyGO.transform;

        target.position = new Vector2(transform.position.x, transform.position.y);
    }
Ejemplo n.º 3
0
    void Awake()
    {
        player            = GameObject.Find("player").transform;
        enemyScript       = gameObject.GetComponent <simple_enemy>();
        enemyScriptHit    = gameObject.GetComponent <MeleeG>();
        possiblePlaySound = true;

        lastTimeShoot = 1.0f;
        GameObject newEmptyGO = new GameObject();

        speedIni = speed;
        target   = newEmptyGO.transform;

        target.position = new Vector2(transform.position.x, transform.position.y);
    }
Ejemplo n.º 4
0
    void Awake()
    {
        player         = GameObject.Find("player").transform;
        onCharge       = false;
        enemyScript    = gameObject.GetComponent <simple_enemy>();
        enemyScriptHit = gameObject.GetComponent <MeleeC>();

        animator = enemyScript.animator;

        lasTimeAttack = -20;
        GameObject newEmptyGO = new GameObject();

        target          = newEmptyGO.transform;
        inicial_speed   = speed;
        target.position = new Vector2(transform.position.x, transform.position.y);
    }
Ejemplo n.º 5
0
    void checkIfHitByPlayer(Collider2D other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            // se atacarmos um inimigo precisamos joga-lo para trás
            // vamos criar um vetor na direcao do inimigo

            playermelee playerMeleeScript = other.gameObject.GetComponent <playermelee>();
            if (playerMeleeScript.isAttackingMelee && !isHit)
            {
                Rigidbody2D  rbEnemy         = gameObject.GetComponent <Rigidbody2D>();
                Transform    playerTransform = other.gameObject.GetComponent <Transform>();
                EnemyShotAI  enemyScriptAI   = gameObject.GetComponent <EnemyShotAI>();
                simple_enemy enemyScript     = gameObject.GetComponent <simple_enemy>();

                pushDirection       = (((Vector2)transform.position - (Vector2)playerTransform.position)).normalized;
                enemyScript.health -= 2;

                TimeStartHit = Time.time;
                isHit        = true;
            }
        }
    }