Exemple #1
0
    private void Start()
    {
        m_playerHealth = GameConfiguration.Instance.Player.GetComponent <HealthBehaviour>();

        m_playerHealth.OnHitTaken        += PlayerDamaged;
        m_levelOrchestrator.OnBossAppear += ShowBossUI;
    }
        private void OnTriggerEnter2D(Collider2D other)
        {
            TagBehaviour tagBehaviour = other.GetComponent <TagBehaviour>();

            if (tagBehaviour == null)
            {
                return;
            }

            // Destroy when impacting solid objects
            if (tagBehaviour.HasTag("Solid"))
            {
                Sparks();
                Destroy(gameObject);
            }

            // Damage target
            if (tagBehaviour.HasTag(TargetTag))
            {
                HealthBehaviour healthBehaviour = other.GetComponent <HealthBehaviour>();
                if (healthBehaviour != null)
                {
                    healthBehaviour.Value -= Damage;
                    Destroy(gameObject);
                }
            }
        }
Exemple #3
0
 private void Start()
 {
     _notice   = GetComponent <NoticeBehaviour>();
     _bow      = GetComponentInChildren <BowBehaviour>();
     _playerHp = GameObject.FindGameObjectWithTag("Player").GetComponent <HealthBehaviour>();
     _nav      = GetComponent <NavMeshAgent>();
 }
    public void MyUpdate()
    {
        Move();
        if (target == null)
        {
            return;
        }

        //get the distance between the chaser and the target
        float distance = Vector2.Distance(transform.position, target.position);

        //so long as the chaser is farther away than the minimum distance, move towards it at rate speed.
        if (distance < MINDIST)
        {
            HealthBehaviour health = target.GetComponent(typeof(HealthBehaviour)) as HealthBehaviour;
            DamageBehaviour damage = gameObject.GetComponent(typeof(DamageBehaviour)) as DamageBehaviour;
            if (health != null && damage != null)
            {
                if (!health.IsImmune)
                {
                    target.GetComponent <AudioSource>().Play();
                }
                health.ApplyDamage(damage.DamageAmount);
            }
        }

        if (target.position.x > transform.position.x && xMoveDirection < 0 ||
            target.position.x < transform.position.x && xMoveDirection > 0)
        {
            xMoveDirection *= -1;
        }
    }
        private void Awake()
        {
            _playerHealthBehaviour = GameObject.Find("Player").GetComponent <HealthBehaviour>();
            _roomTraversedEventId  = EventManager.Register <RoomTraversedEventArgs>(OnRoomTraversedEvent);

            Description = string.Format(Description, IncreaseValue);
        }
Exemple #6
0
 private void OnDieHandler()
 {
     UserInfo.KillEnemy();
     MeshRenderer.material.color = DieColor;
     AttackBehaviour.Untarget();
     Target = null;
 }
Exemple #7
0
    public void Awake()
    {
        _moveBehaviour   = GetComponent <MoveBehaviour>();
        _healthBehaviour = GetComponent <HealthBehaviour>();

        _startPos = transform.position;
    }
 private void SetHealthUI(HealthBehaviour healthBehaviour)
 {
     if (healthBehaviour.Equals(characterHealth))
     {
         SetHealthUI();
     }
 }
Exemple #9
0
 private void Start()
 {
     _hp = GetComponent <HealthBehaviour>();
     Debug.Log("<color=green>FIXING TIME SCALE</color>");
     Time.fixedDeltaTime = startingFixedDeltaTime;
     Time.timeScale      = startingTimeScale;
 }
Exemple #10
0
        public override void Start()
        {
            base.Start();

            Description      = string.Format(Description, IncreaseValue);
            _healthBehaviour = GameObject.Find("Player").GetComponent <HealthBehaviour>();
        }
 private void Start()
 {
     _targetHealthBehaviour   = Target.GetComponent <HealthBehaviour>();
     _healthChangedEventId    = EventManager.Register <HealthChangedEventArgs>(OnHealthChanged);
     _healthMaxChangedEventId = EventManager.Register <HealthMaxChangedEventArgs>(OnHealthMaxChanged);
     UpdateCells();
 }
    protected virtual void CheckAttackCollisions()
    {
        float   direction    = m_characterController.FacingDirection == EDirection.LEFT ? -1f : 1f;
        Vector2 attackOrigin = new Vector2(transform.position.x + (direction * (m_sr.size.x / 2f)),
                                           transform.position.y + m_sr.size.y / 2f);

        Vector2 boxOrigin = new Vector2(attackOrigin.x + (direction * (m_attackX / 2f)), attackOrigin.y);

        Collider2D[] collisions = Physics2D.OverlapBoxAll(boxOrigin, new Vector2(m_attackX, m_attackY), 0f, LayerMask.GetMask("HitBox"));

        Debug.Log("CheckAttackCollisions : " + collisions.Length);

        for (int i = 0; i < collisions.Length; i++)
        {
            Debug.Log("CheckAttackCollisions : " + TargetTag);
            Debug.Log("CheckAttackCollisions : " + collisions[i].tag);

            if (collisions[i].CompareTag(TargetTag))
            {
                HealthBehaviour hittable = collisions[i].GetComponentInParent <HealthBehaviour>();
                if (hittable != null && hittable.gameObject != gameObject)
                {
                    hittable.Hit(gameObject, m_damage);
                }
            }
        }
        Debug.Log("CheckAttackCollisions : END");
    }
 private void DecreaseHealth(HealthBehaviour hb)
 {
     if (hb.Health > 0)
     {
         hb.CharacterTakeDamage(_attackDamage);
         hb.ChangeHealth(hb.Health);
     }
 }
Exemple #14
0
    public void Start()
    {
        playerStats = GetComponentInParent <PlayerGameplayValues>();

        controllerBehaviour = transform.parent.GetComponent <ControllerBehaviour>();
        healthBehaviour     = transform.parent.GetComponent <HealthBehaviour>();
        bowController       = transform.parent.GetComponent <BowController>();
    }
 // Start is called before the first frame update
 void Start()
 {
     mobileHealth = transform.GetComponentInParent <HealthBehaviour>();
     mobileHealth.OnDamageTakenEvent += new HealthBehaviour.OnDamageTakenEventHandler(OnDamageTakenEvent);
     slider = transform.Find("Slider").GetComponent <Slider>();
     fill   = slider.transform.Find("Fill").GetComponent <Image>();
     Init();
 }
    void Start()
    {
        m_rb2d         = GetComponent <Rigidbody2D>();
        m_healthSystem = GetComponent <HealthBehaviour>();

        m_healthSystem.OnDeath += Death;
        m_healthSystem.OnHit   += Attack;
    }
Exemple #17
0
 void Start()
 {
     currentHealth               = type.maxHealth;
     m_Animator                  = gameObject.GetComponent <Animator>();
     m_healthBehaviour           = GetComponent <HealthBehaviour>();
     m_healthBehaviour.maxHealth = type.maxHealth;
     m_healthBehaviour.health    = type.maxHealth;
 }
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.CompareTag("Player"))
     {
         HealthBehaviour playerHealthScript = collision.gameObject.GetComponent <HealthBehaviour>();
         playerHealthScript.TakeDamage(damageAmount);
     }
 }
    private void Awake()
    {
        m_healthBehaviour = GetComponentInParent <HealthBehaviour>();
        UpdateLife();

        m_healthBehaviour.OnHit  += (GameObject p_attacker, int p_amount) => { UpdateLife(); };
        m_healthBehaviour.OnHeal += (int p_amount) => { UpdateLife(); };
    }
        public ArticleConfigDetail(ConfigCode _code, ConfigName _name, ConfigGang _gang,
                                   ConfigType _type, ConfigBind _bind,
                                   TaxingBehaviour _taxing, HealthBehaviour _health, SocialBehaviour _social, params ConfigCode[] _path)
            : base(_code, _gang, _type, _bind, _taxing, _health, _social)
        {
            InternalName = _name;

            InternalPath = _path.ToList();
        }
Exemple #21
0
 private void Awake()
 {
     _playerScript            = GetComponent <Player>();
     _playerRigidbody         = _playerScript.GetComponent <Rigidbody>();
     _playerShootingBehaviour = _playerScript.GetComponent <ShootingBehaviour>();
     _playerStealthBehaviour  = _playerScript.GetComponent <StealthBehaviour>();
     _playerCollider          = _playerScript.GetComponent <Collider>();
     _healthBehaviour         = _playerScript.GetComponent <HealthBehaviour>();
 }
        private void Start()
        {
            GameObject playerObject = GameObject.Find("Player");

            _playerMovementBehaviour = playerObject.GetComponent <PlayerMovementBehaviour>();
            _healthBehaviour         = playerObject.GetComponent <HealthBehaviour>();

            _damageRateInverse = 1.0f / DamageRate;
        }
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.name == "Player")
     {
         HealthBehaviour healthBehaviour = other.GetComponent <HealthBehaviour>();
         healthBehaviour.Value -= Damage;
         _boxCollider2D.enabled = false;
     }
 }
Exemple #24
0
    private void Awake()
    {
        RandomizeRooms();
        DeckShuffler.Shuffle(enemyDeck.Cards);
        enemyDeck.ResetIndex();

        player       = GameObject.FindGameObjectWithTag("Player").GetComponent <Combatant>();
        playerHealth = player.GetComponent <HealthBehaviour>();
    }
    private void OnCollisionEnter(Collision collision)
    {
        HealthBehaviour health = collision.gameObject.GetComponent <HealthBehaviour>();

        if (health != null && health.name == _target.name)
        {
            health.TakeDamage(_damage);
        }
    }
Exemple #26
0
    private void OnDisable()
    {
        HealthBehaviour healthBehaviour = GetComponent <HealthBehaviour>();

        if (healthBehaviour != null)
        {
            healthBehaviour.OnDeath -= HandleOnDeath;
        }
    }
Exemple #27
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Player")
     {
         if (HealthBehaviour.IsLife)
         {
             Target = other.GetComponent <HealthBehaviour>();
         }
     }
 }
Exemple #28
0
    private void OnCollisionEnter(Collision collision)
    {
        HealthBehaviour health = collision.gameObject.GetComponent <HealthBehaviour>();

        if (health != null)
        {
            health.TakeDamage(20);
        }
        Destroy(gameObject, 1f);
    }
    private void OnTriggerEnter(Collider other)
    {
        HealthBehaviour health = other.GetComponent <HealthBehaviour>();

        if (health != null && other.name != owner)
        {
            health.TakeDamage(_damage);
            Destroy(gameObject);
        }
    }
        public ConfigStub CloneMasterStub(ConfigCode _code, ConfigRole _role, ConfigGang _gang,
                                          ConfigType _type, ConfigBind _bind,
                                          TaxingBehaviour _taxing, HealthBehaviour _health, SocialBehaviour _social)
        {
            ConfigStub returnStub = CloneUtils <ConfigStub> .CloneOrNull(InternalStub);

            returnStub.SetSourceConfig(_code, _role, _gang, _type, _bind, _taxing, _health, _social);

            return(returnStub);
        }