Inheritance: MonoBehaviour
Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        ia = GetComponent <EnemyIA>();
        animacionZombie = ia.animator;

        posJugador = ia.target;
    }
Esempio n. 2
0
 protected override void OnStarting()
 {
     //create the hitboxlogic to spam damage to the player
     ddealer           = shootPoint.gameObject.AddComponent <DamageDealer>();
     ddealer.damage    = this.damage;
     ddealer.canDamage = true;
     enemyIa           = GetComponent <EnemyIA>();
 }
Esempio n. 3
0
 void Start()
 {
     // declaracion del estado en el que inicia el enemigo al entrar en el escenario
     ActualState   = EnemyIA.patrulla;
     matriz        = nodo[1];                    // la matriz que contiene los nodos los cuales el enemigo estara cruzando
     gema.position = matriz.position;            // establecemos que iniciara en la posicion de la matriz al ejecutar el programa
     velocidad     = velocidad * Time.deltaTime; // la velocidad de la que sera modifibale en el inspector
     indiceMatriz  = 0;                          // el inidce por el que empezara a contar los nodos
 }
Esempio n. 4
0
 void OnTriggerEnter(Collider col)
 {
     zombie = transform.parent.gameObject.GetComponent <EnemyIA>();
     if (zombie.GetComponent <Stats>().hp > 0 && !zombie.target && col.gameObject.CompareTag("Player"))
     {
         zombie.target = col.gameObject;
         zombie.anim.SetBool("run", true);
     }
 }
Esempio n. 5
0
    public int fleeOperateModifier = 5;   // bonus en flat par level d'opérate



    // Use this for initialization
    void Start()
    {
        iAMng            = GetComponent <EnemyIA>();
        statsSCR         = GetComponent <EnemyStats>();
        shipMap          = GameObject.FindGameObjectWithTag("Manager").GetComponent <ShipMap>();
        eventsMng        = GameObject.FindGameObjectWithTag("Manager").GetComponentInChildren <EventsMainManager>();
        weaponsMng       = GameObject.FindGameObjectWithTag("Manager").GetComponent <WeaponManager>();
        weaponsMng.enemy = gameObject;
        StartCoroutine(RepairHullCrt());
        StartCoroutine(InitCrew());
    }
Esempio n. 6
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Enemy"))
        {
            IAfromActualEnemy = other.GetComponent <EnemyIA>();

            if (IAfromActualEnemy != null && IAfromActualEnemy.canJump)
            {
                IAfromActualEnemy.Jump();
            }
        }
    }
Esempio n. 7
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     //Debug.Log("Collided with: " + collision);
     // Access the player and change an attribute and later self destroy
     if (collision.tag == "Enemy")
     {
         EnemyIA enemy = collision.GetComponent <EnemyIA>();
         enemy.DestroyEnemy();
         Destroy(this.gameObject);
         if (transform.parent)
         {
             Destroy(transform.parent.gameObject);
         }
     }
 }
Esempio n. 8
0
    IEnumerator wait(float timePause)
    {
        for (int i = 0; i < waveIncrement; i++)
        {
            GameObject enemy      = (GameObject)Instantiate(Enemy, spawnLocation.position, spawnLocation.rotation);
            EnemyIA    pathfinder = enemy.GetComponent <EnemyIA>();

            if (pathfinder != null)
            {
                pathfinder.target = this.target;
            }

            yield return(new WaitForSeconds(timePause));
        }
        waveIncrement++;
    }
    // Start is called before the first frame update
    void Start()
    {
        actualHealth = maxHealth;
        alive        = true;
        animator     = GetComponent <Animator>();
        weapon       = GetComponentInChildren <EnemyWeapon>();
        enemyIA      = GetComponent <EnemyIA>();
        agent        = GetComponent <NavMeshAgent>();
        rigidbody    = GetComponent <Rigidbody>();
        collider     = GetComponent <Collider>();


        if (animator)
        {
            animator.SetBool("dead", false);
        }
    }
Esempio n. 10
0
    void Update()
    {
        // Establecemos la direccion que se movera dependiendo el acomodo de los nodos, seguira un orden en lista
        Vector3 dir             = matriz.position - gema.position;
        float   distancia       = Vector3.Distance(gema.position, matriz.position); // deteccion de la distancia entre el objeto y el siguiente nodo
        float   distanciaPlayer = Vector3.Distance(gema.position, player.position); // deteccion de distancia entre objeto yel jugador

        // traslacion de objeto a la posicion del nodo
        gema.Translate(dir.normalized * velocidad, Space.World);

        // iniciamos el primero comprtamiento al comparar el estado del objeto
        if (ActualState == EnemyIA.patrulla)
        {
            matriz = nodo[indiceMatriz];

            if (distancia <= 0.5f)
            {
                if (indiceMatriz >= nodo.Length - 1)
                {
                    indiceMatriz = 0;
                    matriz       = nodo[indiceMatriz];
                }

                indiceMatriz++;
                matriz = nodo[indiceMatriz];
            }
        }
        // Cambio de estado al reconocer que la distacia es menor de lo estipulado, entre el objeto y el jugador
        if (distanciaPlayer <= 2)
        {
            ActualState = EnemyIA.perseguir;

            // Cambia entre la matriz al jugador para que sea perseguido
            if (ActualState == EnemyIA.perseguir)
            {
                matriz = player;
            }
        }
        else if (distanciaPlayer >= 2)      // If para regresar a su estado patrulla, asi si el jugador esta alejado, el objeto seguira su trayectoria
        {
            ActualState = EnemyIA.patrulla; // y si el jugador se aleja post acercarse al mob, este regresara a su estado patrulla
            if (ActualState == EnemyIA.patrulla)
            {
            }
        }
    }
Esempio n. 11
0
    void OnSceneGUI()
    {
        EnemyIA fow = (EnemyIA)target;

        Handles.color = Color.white;
        Handles.DrawWireArc(fow.transform.position, Vector3.up, Vector3.forward, 360, fow.viewRadius);
        Vector3 viewAngleA = fow.DirFromAngle(-fow.viewAngle / 2, false);
        Vector3 viewAngleB = fow.DirFromAngle(fow.viewAngle / 2, false);

        Handles.DrawLine(fow.transform.position, fow.transform.position + viewAngleA * fow.viewRadius);
        Handles.DrawLine(fow.transform.position, fow.transform.position + viewAngleB * fow.viewRadius);

        Handles.color = Color.red;
        foreach (Transform visibleTarget in fow.visibleTargets)
        {
            Handles.DrawLine(fow.transform.position, visibleTarget.position);
        }
    }
Esempio n. 12
0
    // Método para que la bala se destruya al colisionar con cualquier objeto.
    private void OnTriggerEnter2D(Collider2D coll)
    {
        EnemyIA enemigo = coll.gameObject.GetComponent <EnemyIA>();

        if (!coll.gameObject.Equals(GameObject.Find("Personaje")) && !GetComponent <CircleCollider2D>().IsTouchingLayers(mascaraActivadorCaida) &&
            !GetComponent <CircleCollider2D>().IsTouchingLayers(mascaraEscalera) && !GetComponent <CircleCollider2D>().IsTouchingLayers(mascaraRangoAtaqueEnemigo))
        {
            GameObject.Destroy(this.gameObject);
        }
        else if (enemigo != null)
        {
            enemigo.setDanyo(danyo);
            GameObject.Destroy(this.gameObject);
        }
        else if (GetComponent <CircleCollider2D>().IsTouchingLayers(mascaraSuelo))
        {
            GameObject.Destroy(this.gameObject);
        }
    }
Esempio n. 13
0
        private void EnemyTurn()
        {
            EnemyIA EnemyChoice = new EnemyIA(_playerCollection, _IACollection, PlayingUnitID);

            // Analyse Situation
            EnemyChoice.UnitsAnalyse();

            // Choose a Spell Memorise it as "BestSpell"
            EnemyChoice.CheckUnitSpells(_IACollection[PlayingUnitID].spellList);

            //Find Player Target
            var Target = EnemyChoice.FindUnitTarget();

            //Define the Spell Target Zone
            var TargetZone = EnemyChoice.FindUnitTargetZone(Target, EnemyChoice.BestSpell.spellTarget);

            // Do Action
            EnemyChoice.UseSpell(TargetZone);

            // Send to Client the IA Attack
            ServerSend.AttackPlayersUnits(ClientID, EnemyChoice.PlayingUnitID, EnemyChoice.IATargetUnitID, EnemyChoice.BestSpell.spellTarget, EnemyChoice.BestSpell.SpellID);
        }
Esempio n. 14
0
 //Call every frame
 void Start()
 {
     anim   = GetComponent <Animator> ();
     Player = GetComponent <EnemyIA>();
 }
 public StateFire(EnemyIA enemy)
 {
     this.enemy = enemy;
 }
Esempio n. 16
0
 public StatePatrol(EnemyIA enemy)
 {
     this.enemy = enemy;
 }
Esempio n. 17
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     IA = animator.gameObject.GetComponent <EnemyIA>();
     IA.ChangeFOVColor(EnemyIA.FOVColor.chasing);
     IA.Catched();
 }
 public StateFollow(EnemyIA enemy)
 {
     this.enemy = enemy;
 }
Esempio n. 19
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 public override void OnStateEnter(Animator animator, AnimatorStateInfo animatorStateInfo, int layerIndex)
 {
     IA = animator.gameObject.GetComponent <EnemyIA>();
     IA.ChangeFOVColor(EnemyIA.FOVColor.searching);
 }
Esempio n. 20
0
 // Use this for initialization
 void Start()
 {
     enemyScript = GetComponent <EnemyIA>();
 }
Esempio n. 21
0
 // Use this for initialization
 void Start()
 {
     iAMng = GetComponent<EnemyIA>();
     statsSCR = GetComponent<EnemyStats>();
     shipMap = GameObject.FindGameObjectWithTag("Manager").GetComponent<ShipMap>();
     eventsMng = GameObject.FindGameObjectWithTag("Manager").GetComponentInChildren<EventsMainManager>();
     weaponsMng = GameObject.FindGameObjectWithTag("Manager").GetComponent<WeaponManager>();
     weaponsMng.enemy = gameObject;
     StartCoroutine(RepairHullCrt());
     StartCoroutine(InitCrew());
 }