public void ReceiveHit(HitBox hitbox)
        {
            GlobalScriptMachine.Launch(scripts);
            bool applied = false;

            if (combo != null)
            {
                applied = combo.ReceiveDamage(hitbox.dmg, hitbox.GetCenter() + Vector3.forward * fighter.gameObject.transform.position.z);
            }

            if (applied)
            {
                particle.InstantiateAndDestroy(hitbox.GetCenter() + Vector3.forward * fighter.gameObject.transform.position.z, 2f);
            }

            if (stun != null && applied)
            {
                stun.AddStun(hitbox.stun, hitbox.GetCenter() + Vector3.forward * fighter.gameObject.transform.position.z);
            }


            if (guardBreak != null && !applied)
            {
                guardBreak.AddGuardBreak(hitbox.guardDmg, hitbox.GetCenter() + Vector3.forward * fighter.gameObject.transform.position.z);
            }
        }
Exemple #2
0
        public bool ReceiveDamage(float dmg, Vector3 position)
        {
            if (onReceiveDamage != null)
            {
                foreach (var handle in onReceiveDamage.GetInvocationList())
                {
                    if ((bool)handle.DynamicInvoke(dmg, position))
                    {
                        return(false);
                    }
                }
            }

            GlobalScriptMachine.Launch(onHit);

            if (dmg > 25)
            {
                fighter.AddScript(hitSound[0]);
            }
            else if (dmg > 15)
            {
                fighter.AddScript(hitSound[1]);
            }
            else
            {
                fighter.AddScript(hitSound[2]);
            }

            fighter.ApplyEvent(LZFIGHTEREVENT.HIT);
            currentCombo += dmg;
            currentCombo  = Mathf.Clamp(currentCombo, 0, life.CurrentLife);
            Debug.Log("Damaged");
            return(true);
        }
Exemple #3
0
 public override void Start()
 {
     base.Start();
     GlobalScriptMachine.Launch(new TimeBend()
     {
         time  = time,
         curve = curve
     });
     Kill();
 }
    public static void Shake(this Camera camera, float strength, float frequency, float time)
    {
        Shake shake = new Shake();

        shake.camera    = camera;
        shake.strength  = strength;
        shake.frequency = frequency;
        shake.time      = time;
        GlobalScriptMachine.Launch(shake);
    }
 public static FollowMultiple FollowMultiple(this Camera camera, params Transform[] targets)
 {
     return((FollowMultiple)
            GlobalScriptMachine
            .Launch(new FollowMultiple()
     {
         camera = camera,
         targets = targets,
     }));
 }
 public static void LimitX(this Camera camera, float minX, float maxX)
 {
     GlobalScriptMachine
     .Launch(new LimitX()
     {
         camera = camera,
         minX   = minX,
         maxX   = maxX
     });
 }
Exemple #7
0
 public static ClampToCamera ClampToCamera(this Transform transform, Camera camera, float threshold)
 {
     return((ClampToCamera)
            GlobalScriptMachine
            .Launch(new ClampToCamera()
     {
         transform = transform,
         camera = camera,
         threshold = threshold
     }));
 }
 public static MoveTo MoveTo(this RectTransform transform, Vector3 origin, Vector3 target, float duration = 0f)
 {
     return((MoveTo)
            GlobalScriptMachine
            .Launch(new MoveTo()
     {
         transform = transform,
         origin = origin,
         target = target,
         duration = duration
     }));
 }