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

        if (playerCombat != null)
        {
            playerCombat.Attack(myStats);
        }
    }
示例#3
0
 // 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;
 }
示例#5
0
    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
    }
示例#6
0
    public override void Interact()
    {
        base.Interact();
        CharacterCombat playerCombat = playerManager.GetComponent <CharacterCombat>();

        if (playerCombat != null)
        {
            playerCombat.Attack(myStats);
        }
    }
示例#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);
        }
示例#8
0
文件: Enemy.cs 项目: DanZinov/RPG
    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);
        }
    }
示例#10
0
    // 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);
    }
示例#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;
    }
示例#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>();
    }
示例#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>();
    }
示例#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>();
        }
示例#15
0
    public override void Interact()
    {
        //Attack enemy oðlum yav

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

        if (playerCombat != null)
        {
            playerCombat.Attact(myStats);
        }
    }
示例#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);
         }
     }
 }
示例#17
0
    public override void Interact()
    {
        base.Interact();
//		StartCoroutine ("InvokeAttack");
        CharacterCombat playerCombat = playerManager.player.GetComponent <CharacterCombat>();

        if (playerCombat != null)
        {
            playerCombat.Attack(myStats);
        }
    }
示例#18
0
    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");
        }
    }
示例#19
0
    public override void Interact()
    {
        base.Interact();
        //Attack
        CharacterCombat pC = pM.player.GetComponent <CharacterCombat>();

        if (pC != null)
        {
            pC.Attack(myStats);
        }
    }
示例#20
0
文件: Enemy.cs 项目: valpioner/RPG
 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
     }
 }
示例#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>();
    }
示例#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);
        }
    }
示例#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>();
 }
示例#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>();
    }
示例#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);
        }
    }
示例#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);
            }
        }
示例#30
0
    public override void Interact()
    {
        base.Interact();
        CharacterCombat _playerCombat
            = PlayerManager.ins.player.GetComponent <CharacterCombat> ();

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