Exemplo n.º 1
0
        private void OnCharacterAttacks(Object p_sender, EventArgs p_args)
        {
            AttacksEventArgs attacksEventArgs = (AttacksEventArgs)p_args;

            if (attacksEventArgs.Attacks.Count == 0)
            {
                OnCharacterFXDone(p_sender, p_args);
                return;
            }
            Character character = (Character)p_sender;

            character.FightHandler.FlushActionLog();
            character.EnchantmentHandler.FlushActionLog();
            DelayedEventManager.InvokeEvent(EDelayType.ON_FX_HIT, EEventType.CHARACTER_ATTACKS, p_sender, p_args);
            GameObject currentCamera = FXMainCamera.Instance.CurrentCamera;

            if (currentCamera != null)
            {
                Int32      num        = Random.Range(1, 4);
                GameObject gameObject = Helper.Instantiate <GameObject>(Helper.ResourcesLoad <GameObject>("FX/Hit/HitFx" + num));
                Vector3    a          = Vector3.zero;
                foreach (AttacksEventArgs.AttackedTarget attackedTarget in attacksEventArgs.Attacks)
                {
                    if (attackedTarget.AttackTarget != null && attackedTarget.AttackTarget is Monster)
                    {
                        Monster          p_controller = (Monster)attackedTarget.AttackTarget;
                        GameObject       gameObject2  = ViewManager.Instance.FindView(p_controller).gameObject;
                        MonsterHPBarView component    = gameObject2.GetComponent <MonsterHPBarView>();
                        a = gameObject2.transform.position + new Vector3(0f, component.HPBarAnchor.position.y / 1.8f, 0f);
                    }
                }
                gameObject.transform.position = a - currentCamera.transform.forward * 1.9f;
                gameObject.transform.rotation = currentCamera.transform.rotation;
                Destroy(gameObject.gameObject, 0.5f);
            }
        }
Exemplo n.º 2
0
 public Boolean CheckCollision(MonsterHPBarView p_other)
 {
     return(Intersect(m_barCollisionBox, p_other.BarCollisionBox) || Intersect(m_barCollisionBox, p_other.NameCollisionBox) || (p_other.BuffCount > 0 && Intersect(m_barCollisionBox, p_other.BuffsCollisionBox)) || Intersect(m_nameCollisionBox, p_other.BarCollisionBox) || Intersect(m_nameCollisionBox, p_other.NameCollisionBox) || (p_other.BuffCount > 0 && Intersect(m_nameCollisionBox, p_other.BuffsCollisionBox)) || (m_buffCount > 0 && Intersect(m_buffsCollisionBox, p_other.BarCollisionBox)) || (m_buffCount > 0 && Intersect(m_buffsCollisionBox, p_other.NameCollisionBox)) || (m_buffCount > 0 && p_other.BuffCount > 0 && Intersect(m_buffsCollisionBox, p_other.BuffsCollisionBox)));
 }