Пример #1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == TargetTag &&
         !hittedTargets.Contains(collision) &&
         (HitAll || hittedTargets.Count <= 0))
     {
         //Debug.Log($"Target Enter : {TargetTag}");
         hittedTargets.Add(collision);
         var damage = SkillDamage.GetDamageData(Character.Property);
         damage.HitAt   = collision.transform.position;
         damage.HitFrom = Character.transform.position;
         collision.gameObject.GetComponentInParent <ICharacterActionManager>()
         .OnHit(damage);
     }
 }
Пример #2
0
        private void ShootingProjector()
        {
            #region 取得發射位置
            IsometricUtility.GetVerticalAndHorizontal(Character.RunTimeData.Direction
                                                      , out float vertical, out float horizontal);
            var positionIndex = ((int)vertical + 1) * 3 + (int)horizontal + 1;
            positionIndex = positionIndex > 4 ? positionIndex - 1 : positionIndex;
            var startPosition = ShottingPoints[positionIndex].position;
            #endregion

            var damage = SkillDamage.GetDamageData(Character.Property);
            damage.HitFrom = gameObject.gameObject.transform.position;
            Instantiate(Bullet, startPosition, Quaternion.identity)
            .GetComponent <ProjectSkillCollider>()
            .Shooting(Character.RunTimeData.TargetPosition, damage);
        }