Beispiel #1
0
    public void SpawnHitMarker(SkillData skillData)
    {
        GameObject go = Instantiate(hitMarkerGO, _initialPos, Quaternion.identity);

        SetActiveHitMarker(go);
        activeHitMarker.SetPositions(_checkPoints[0].GetComponent <RectTransform>().localPosition, _checkPoints[1].GetComponent <RectTransform>().localPosition);
        activeHitMarker.SetSpeed(_speed);

        _hitBar = go.GetComponent <HitBar>();

        if (_combatManager.activeSkill.curHitsCompleted == 0)
        {
            UpdateRemainingHitsText(true, -(_combatManager.activeSkill.hitsRequired - hitCount));
        }

        activeHitMarkerCollider = go.GetComponent <BoxCollider2D>();
        _hitMarkerVisual        = go.transform.GetChild(0).gameObject;
    }
        private void OnTriggerEnter2D(Collider2D collider)
        {
            if (collider.Equals(targetCollider) == false)
            {
                return;
            }

            Bar bar = collider.GetComponentInParent <Bar>();

            if (bar == null)
            {
                return;
            }

            transform.DOKill();
            bar.Hide();
            ResetSelf();
            HitBar?.Invoke();
        }
Beispiel #3
0
 void Start()
 {
     m_hitbar = gameObject.GetComponent <HitBar>();
 }
Beispiel #4
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        hitbar = animator.gameObject.GetComponentInChildren <HitBar>(true);

        hitbar.gameObject.SetActive(true);
    }