void OnTriggerEnter2D(Collider2D coll)
 {
     if (coll.gameObject.GetComponent <CharacterCombat>() != null)
     {
         CharacterCombat target = coll.gameObject.GetComponent <CharacterCombat>();
         target.receiveHit(this);
         GetComponent <Collider2D>().enabled = false;
     }
 }
Beispiel #2
0
    public void Interact()
    {
        CharacterCombat playerCombat = pm.player.GetComponent <CharacterCombat>();

        if (playerCombat != null)
        {
            playerCombat.Attack(myStats);
        }
    }
 // Start is called before the first frame update
 void Start()
 {
     // Main interaction with target
     target = PlayerManager.instance.PlayerGO.transform;
     // Movement terrain
     agent = GetComponent <NavMeshAgent>();
     // Combat status
     combat = GetComponent <CharacterCombat>();
 }
 /*
  * initialize variables, subscribe OnAttack to CharacterCombat delegate
  */
 protected virtual void Start()
 {
     navmeshAgent = GetComponent <NavMeshAgent> ();
     combat       = GetComponent <CharacterCombat> ();
     //stats = GetComponent<CharacterStats> ();
     stats            = GetComponent <EnemyStats>();
     combat.OnAttack += OnAttack;
     stats.OnDeath   += OnDeath;
 }
    private void Start()
    {
        target = PlayerManager.instance.player.transform;
        agent  = GetComponent <NavMeshAgent>();
        combat = GetComponent <CharacterCombat>();

        //agent.updatePosition = false;
        //agent.updateRotation = false;
        //https://answers.unity.com/questions/889836/using-unity-navigation-in-a-fixed-timestep.html
    }
Beispiel #6
0
    public override void Interact()
    {
        base.Interact();
        CharacterCombat playerCombat = playerManager.GetComponent <CharacterCombat>();

        if (playerCombat != null)
        {
            playerCombat.Attack(myStats);
        }
    }
Beispiel #7
0
        int m_CurrentWaypointIndex       = 0;                               //Holds the current index of the Patrol AI


        private void Awake()
        {
            m_Mover           = GetComponent <CharacterMovement>();
            m_Combat          = GetComponent <CharacterCombat>();
            m_Health          = GetComponent <Health>();
            m_Player          = GameObject.FindWithTag("Player");
            m_ActionScheduler = GetComponent <ActionScheduler>();

            m_StartPosition = new LazyValue <Vector3>(GetStartingPosition);
        }
Beispiel #8
0
    public override void Interact()
    {
        base.Interact();
        CharacterCombat playerCombat = GameObject.FindGameObjectWithTag("Player").GetComponent <CharacterCombat>();

        if (playerCombat != null)
        {
            playerCombat.Attack(myStats);
        }
    }
    // Update is called once per frame
    public override void Use()
    {
        base.Use()
        CharacterCombat playerCombat = player.player.GetComponent <CharcterCombat>();

        if (playerCombat != null)
        {
            playerCombat.Attack(myStats);
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        target      = PlayerManager.instance.player.transform;
        anim        = GetComponentInChildren <Animator>();
        myRigidbody = GetComponent <Rigidbody2D>();
        combat      = GetComponent <CharacterCombat>();

        timeBetweenRandomMoveCounter = Random.Range(3f, 7f);
        movementTimeCounter          = Random.Range(0f, 1f);
    }
Beispiel #11
0
    protected virtual void Start()
    {
        agent             = GetComponent <NavMeshAgent>();
        animator          = GetComponentInChildren <Animator>();
        combat            = GetComponent <CharacterCombat>();
        overideController = new AnimatorOverrideController(animator.runtimeAnimatorController);
        animator.runtimeAnimatorController = overideController;

        currentAnimationAttackSet = defaultAnimationSet;
    }
Beispiel #12
0
    void Awake()
    {
        monsterTr = this.gameObject.GetComponent <Transform>();
        target    = GameObject.FindWithTag("Player").GetComponent <Transform>();

        nvAgent  = this.gameObject.GetComponent <NavMeshAgent>();
        animator = this.gameObject.GetComponent <Animator>();

        combat = GetComponent <CharacterCombat>();
    }
Beispiel #13
0
    // Start is called before the first frame update
    void Start()
    {
        //if (target==null)
        //{
        target = PlayerManager.instance.player.transform;
        //}

        agent  = GetComponent <NavMeshAgent>();
        combat = GetComponent <CharacterCombat>();
    }
Beispiel #14
0
        private void Start()
        {
            _rb2d    = GetComponent <Rigidbody2D>();
            _tilemap = GameObject.Find("Ground").GetComponent <Tilemap>();

            target      = PlayerManager.Instance.player.transform;
            targetStats = target.GetComponent <Player>();
            combat      = GetComponent <CharacterCombat>();
            enemyStats  = GetComponent <Character>();
            pathfinding = GetComponent <Pathfinding>();
        }
Beispiel #15
0
    public override void Interact()
    {
        //Attack enemy oðlum yav

        CharacterCombat playerCombat = playerManager.player.GetComponent <CharacterCombat>();

        if (playerCombat != null)
        {
            playerCombat.Attact(myStats);
        }
    }
Beispiel #16
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.name == "Bullet_Shell")
     {
         CharacterCombat playerCombat = playerManager.player.GetComponent <CharacterCombat>();
         if (playerCombat != null)
         {
             playerCombat.Attack(myStats);
         }
     }
 }
Beispiel #17
0
    public override void Interact()
    {
        base.Interact();
//		StartCoroutine ("InvokeAttack");
        CharacterCombat playerCombat = playerManager.player.GetComponent <CharacterCombat>();

        if (playerCombat != null)
        {
            playerCombat.Attack(myStats);
        }
    }
    public override void Interact()
    {
        base.Interact();
        CharacterCombat playerCombat = playerManager.player.GetComponent <CharacterCombat>();

        if (playerCombat != null)
        {
            playerCombat.Attack(myStats);
            Debug.Log("you are attacking the enemy");
        }
    }
Beispiel #19
0
    public override void Interact()
    {
        base.Interact();
        //Attack
        CharacterCombat pC = pM.player.GetComponent <CharacterCombat>();

        if (pC != null)
        {
            pC.Attack(myStats);
        }
    }
Beispiel #20
0
 public override void Interact()
 {
     base.Interact();
     // Attack the enemy
     playerCombat = playerManager.player.GetComponent <CharacterCombat>();
     if (playerCombat != null)
     {
         Debug.LogError("isBeingAttacked = true");
         isBeingAttacked = true; // Player loop attack
     }
 }
Beispiel #21
0
    // Use this for initialization
    void Start()
    {
        // Get Player position
        this.target = PlayerManager.instance.player.transform;

        // Get NavMeshAgent
        this.agent = GetComponent <NavMeshAgent>();

        // Get combat stats for this enemy
        this.combat = GetComponent <CharacterCombat>();
    }
Beispiel #22
0
    public override void Interact()
    {
        base.Interact();
        CharacterCombat playerCombat = playerManager.player.GetComponent <CharacterCombat>();

        if (playerCombat != null)
        {
            Debug.Log(transform.name + "attack ");
            playerCombat.Attack(myStats);
        }
    }
Beispiel #23
0
    void BeginCombat(CharacterStats playerStats)
    {
        GameManager.instance.campSelect.allowMovement = false;
        SwitchTarget();

        for (int i = 0; i < enemies.Count; i++)
        {
            CharacterCombat enemyCombat = enemies[i].GetComponent <CharacterCombat>();
            enemyCombat.Attack(playerStats);
        }
    }
 /*
  * initialize variables, subscribe OnAttack to CharacterCombat delegate
  *
  */
 protected virtual void Start()
 {
     stats          = Player.instance.playerStats;
     stats.OnDeath += OnDeath;
     //animator = GetComponent<Animator>();
     ac               = GetComponentInChildren <PlayerController2>();
     navmeshAgent     = GetComponent <NavMeshAgent> ();
     combat           = GetComponent <CharacterCombat> ();
     combat.OnAttack += OnAttack;
     //destructable = GetComponent<Destructable>();
     //destructable.OnAttack += OnAttack;
 }
 void Start()
 {
     joystick   = FindObjectOfType <Joystick>();
     animator   = GetComponent <Animator>();
     charCombat = this.GetComponent <CharacterCombat>();
     charCombat.getHurtAction += onHurt;
     charCombat.onDeathAction += death;
     rigidbody = GetComponent <Rigidbody2D>();
     RegisterTickRev();
     prevPosition = transform.position;
     nextPosition = transform.position;
 }
 void Start()
 {
     patrol           = GetComponent <Patrol2>();
     animator         = GetComponent <Animator>();
     target           = PlayerManager.instance.player.transform;
     agent            = GetComponent <NavMeshAgent>();
     combat           = GetComponent <CharacterCombat>();
     hidingEye        = GameObject.Find("HidingEye").GetComponent <Image>();
     playerController = GameObject.Find("unicorn").GetComponent <PlayerController2>();
     targetStats      = target.GetComponent <CharacterStats>();
     patrol2          = GetComponentsInChildren <Patrol2>();
 }
Beispiel #27
0
    // Start is called before the first frame update
    void Start()
    {
        // we would use GameObject.FindGameWithTag
        // but we wwould have to search thru the objects in our scene
        // instead we would have a script to keep track with the player

        target = PlayerManager.instance.player.transform;

        agent = GetComponent <NavMeshAgent>();

        combat = GetComponent <CharacterCombat>();
    }
Beispiel #28
0
    public override void Interact()
    {
        base.Interact();
        // Attack
        CharacterCombat playerCombat = playerManager.player.GetComponent <CharacterCombat>();

        if (playerCombat != null)
        {
            Debug.Log("DAMAGE: " + (myStats.damage.GetValue()));
            playerCombat.Attack(myStats);
        }
    }
Beispiel #29
0
        private void Awake()
        {
            m_Behaviours          = GetComponents <IBehaviour>();
            m_ExecutingBehaviours = new Dictionary <IBehaviour, float>();
            m_CharacterCombat     = GetComponent <CharacterCombat>();
            m_Random = new Random();

            foreach (var behaviour in m_Behaviours)
            {
                behaviour.Initialize(m_Random);
            }
        }
Beispiel #30
0
    public override void Interact()
    {
        base.Interact();
        CharacterCombat _playerCombat
            = PlayerManager.ins.player.GetComponent <CharacterCombat> ();

        //Debug.Log(_playerCombat);
        if (_playerCombat != null)
        {
            _playerCombat.Attack(myStats);
        }
    }