public bool DoesEventMatch(TaeEditAnimEventBox evBox)
            {
                if (evBox.MyEvent.TypeName == null)
                {
                    return(false);
                }

                return(EventTypes.Contains(evBox.MyEvent.TypeName));
            }
예제 #2
0
        public object ToClone()
        {
            var clone = new TaeEditAnimEventBox(OwnerPane, MyEvent, AnimMyEventIsFor);

            clone.CurrentGroupRegion = CurrentGroupRegion;
            clone.EventText          = EventText;
            clone.PrevFrameEnteredState_ForSoundEffectPlayback = PrevFrameEnteredState_ForSoundEffectPlayback;
            clone._row      = _row;
            clone.VisualRow = VisualRow;
            return(clone);
        }
예제 #3
0
        public static Clip EventToClip(TaeEditAnimEventBox ev, bool isBigEndian)
        {
            var clip = new Clip();

            clip.EventType       = ev.MyEvent.Type;
            clip.EventUnk04      = ev.MyEvent.Unk04;
            clip.EventStartTime  = ev.MyEvent.StartTime;
            clip.EventEndTime    = ev.MyEvent.EndTime;
            clip.EventRow        = ev.Row;
            clip.EventParamBytes = ev.MyEvent.GetParameterBytes(isBigEndian);
            return(clip);
        }
예제 #4
0
        public void OnEventExit(TaeEditAnimEventBox evBox)
        {
            var matchingSim = GetSimEntryForEventBox(evBox);

            if (!GetSimEnabled(matchingSim))
            {
                return;
            }

            if (entries[matchingSim] != null)
            {
                entries[matchingSim].ExitAction?.Invoke(entries[matchingSim], evBox);
            }
        }
예제 #5
0
        private int GetBulletParamIDFromEvBox(TaeEditAnimEventBox evBox)
        {
            var behaviorParam = GetBehaviorParamFromEvBox(evBox);

            if (behaviorParam == null)
            {
                return(-1);
            }

            if (behaviorParam.RefType == ParamData.BehaviorParam.RefTypes.Bullet)
            {
                return(behaviorParam.RefID);
            }

            return(-1);
        }
        public void PlaySoundEffectOfBox(TaeEditAnimEventBox evBox)
        {
            if (evBox.MyEvent.TypeName == null || !evBox.MyEvent.TypeName.StartsWith("PlaySound"))
            {
                return;
            }

            int soundType = Convert.ToInt32(evBox.MyEvent.Parameters["SoundType"]);
            int soundID   = Convert.ToInt32(evBox.MyEvent.Parameters["SoundID"]);

            Func <Vector3> getPosFunc = null;

            if (evBox.MyEvent.Template.ContainsKey("DummyPolyID"))
            {
                int dummyPolyID = Convert.ToInt32(evBox.MyEvent.Parameters["DummyPolyID"]);

                getPosFunc = () =>
                {
                    if (dummyPolyID == -1)
                    {
                        return(Vector3.Transform(Vector3.Zero, MODEL.CurrentTransform.WorldMatrix) + new Vector3(0, GFX.World.ModelHeight_ForOrbitCam / 2, 0));
                    }

                    if (MODEL.DummyPolyMan.DummyPolyByRefID.ContainsKey(dummyPolyID))
                    {
                        return(Vector3.Transform(Vector3.Zero,
                                                 MODEL.DummyPolyMan.DummyPolyByRefID[dummyPolyID][0].CurrentMatrix
                                                 * MODEL.CurrentTransform.WorldMatrix));
                    }

                    return(Vector3.Transform(Vector3.Zero, MODEL.CurrentTransform.WorldMatrix) + new Vector3(0, GFX.World.ModelHeight_ForOrbitCam / 2, 0));
                };
            }
            else
            {
                getPosFunc = () => Vector3.Transform(Vector3.Zero, MODEL.CurrentTransform.WorldMatrix) + new Vector3(0, GFX.World.ModelHeight_ForOrbitCam / 2, 0);
            }

            FmodManager.PlaySE(soundType, soundID, getPosFunc);
        }
예제 #7
0
        public void AddEvent(TaeEditAnimEventBox evBox)
        {
            evBox.CurrentGroupRegion?.RemoveEvent(evBox);

            evBox.CurrentGroupRegion = this;
            evBox.MyEvent.Group      = Group;
            if (!Boxes.Contains(evBox))
            {
                Boxes.Add(evBox);
            }

            //if (Boxes.Count == 1)
            //{
            //    StartRow = evBox.Row;
            //    RowCount = 2;
            //}
            //else
            //{
            //    if (evBox.Row >= EndRow)
            //    {
            //        RowCount = evBox.Row - StartRow;
            //    }
            //}
        }
예제 #8
0
 private string GetSimEntryForEventBox(TaeEditAnimEventBox evBox)
 {
     return(entries.FirstOrDefault(kvp => kvp.Value.EventTypes.Contains(evBox.MyEvent.TypeName)).Key);
 }
예제 #9
0
        private ParamData.BehaviorParam GetBehaviorParamFromEvBox(TaeEditAnimEventBox evBox)
        {
            if (evBox.MyEvent.TypeName == "InvokeAttackBehavior" ||
                evBox.MyEvent.TypeName == "InvokeThrowDamageBehavior" ||
                evBox.MyEvent.TypeName == "InvokeBulletBehavior" ||
                evBox.MyEvent.TypeName == "InvokeCommonBehavior" ||
                evBox.MyEvent.TypeName == "InvokePCBehavior" ||
                evBox.MyEvent.TypeName == "InvokeGunBehavior")
            {
                int behaviorSubID = (int)evBox.MyEvent.Parameters["BehaviorSubID"];
                if (MODEL.IS_PLAYER)
                {
                    var id = -1;
                    if (evBox.MyEvent.TypeName == "InvokeCommonBehavior")
                    {
                        id = behaviorSubID;
                    }
                    else if (HitViewDummyPolySource == ParamData.AtkParam.DummyPolySource.RightWeapon && MODEL.ChrAsm?.RightWeapon != null)
                    {
                        id = 10_0000_000 + (MODEL.ChrAsm.RightWeapon.BehaviorVariationID * 1_000) + behaviorSubID;
                    }
                    else if (HitViewDummyPolySource == ParamData.AtkParam.DummyPolySource.LeftWeapon && MODEL.ChrAsm?.LeftWeapon != null)
                    {
                        id = 10_0000_000 + (MODEL.ChrAsm.LeftWeapon.BehaviorVariationID * 1_000) + behaviorSubID;
                    }
                    else if (HitViewDummyPolySource == ParamData.AtkParam.DummyPolySource.Body)
                    {
                        id = behaviorSubID;
                    }

                    if (ParamManager.BehaviorParam_PC.ContainsKey(id))
                    {
                        return(ParamManager.BehaviorParam_PC[id]);
                    }

                    if (HitViewDummyPolySource == ParamData.AtkParam.DummyPolySource.RightWeapon && MODEL.ChrAsm?.RightWeapon != null)
                    {
                        id = 10_0000_000 + ((MODEL.ChrAsm.RightWeapon.WepMotionCategory * 100) * 1_000) + behaviorSubID;
                    }
                    else if (HitViewDummyPolySource == ParamData.AtkParam.DummyPolySource.LeftWeapon && MODEL.ChrAsm?.LeftWeapon != null)
                    {
                        id = 10_0000_000 + ((MODEL.ChrAsm.LeftWeapon.WepMotionCategory * 100) * 1_000) + behaviorSubID;
                    }

                    if (ParamManager.BehaviorParam_PC.ContainsKey(id))
                    {
                        return(ParamManager.BehaviorParam_PC[id]);
                    }
                }
                else
                {
                    if (MODEL.NpcParam == null)
                    {
                        return(null);
                    }

                    int id = -1;

                    if (evBox.MyEvent.TypeName == "InvokeCommonBehavior")
                    {
                        id = behaviorSubID;
                    }
                    else if (HitViewDummyPolySource == ParamData.AtkParam.DummyPolySource.Body)
                    {
                        id = 2_00000_000 + (MODEL.NpcParam.BehaviorVariationID * 1_000) + behaviorSubID;
                    }

                    if (ParamManager.BehaviorParam.ContainsKey(id))
                    {
                        return(ParamManager.BehaviorParam[id]);
                    }
                }
            }

            return(null);
        }
 private void OnEventBoxExit(TaeEditAnimEventBox evBox)
 {
     EventBoxExit?.Invoke(this, evBox);
 }
 private void OnEventBoxEnter(TaeEditAnimEventBox evBox)
 {
     EventBoxEnter?.Invoke(this, evBox);
 }
        private ParamData.AtkParam GetAtkParamFromEventBox(TaeEditAnimEventBox evBox)
        {
            ParamData.AtkParam atkParam = null;
            if (evBox.MyEvent.TypeName == "InvokeAttackBehavior" || evBox.MyEvent.TypeName == "InvokeThrowDamageBehavior")
            {
                if (!MODEL.IS_PLAYER)
                {
                    atkParam = ParamManager.GetNpcBasicAtkParam(MODEL.NpcParam, (int)evBox.MyEvent.Parameters["BehaviorSubID"]);
                }
                else
                {
                    bool isLeftHand = MODEL.DummyPolyMan.IsViewingLeftHandHit;

                    if (evBox.MyEvent.TypeName == "InvokeAttackBehavior")
                    {
                        var atkType = (int)evBox.MyEvent.Parameters["AttackType"];

                        if (atkType == 64 /*Parry*/)
                        {
                            isLeftHand = true;
                        }
                        else if (atkType == 2 /*Forward+R1*/ || atkType == 62 /*Plunging attack*/)
                        {
                            isLeftHand = false;
                        }
                    }


                    atkParam = ParamManager.GetPlayerBasicAtkParam(
                        isLeftHand ? MODEL.ChrAsm.LeftWeapon : MODEL.ChrAsm.RightWeapon,
                        (int)evBox.MyEvent.Parameters["BehaviorSubID"],
                        isLeftHand);
                }
            }
            else if (evBox.MyEvent.TypeName == "InvokeCommonBehavior")
            {
                atkParam = ParamManager.GetPlayerCommonAttack((int)evBox.MyEvent.Parameters["BehaviorParamID"]);
            }
            else if (evBox.MyEvent.TypeName == "InvokePCBehavior")
            {
                if (MODEL.IS_PLAYER)
                {
                    int condition = (int)evBox.MyEvent.Parameters["Condition"];
                    if (condition == 4)
                    {
                        atkParam = ParamManager.GetPlayerCommonAttack((int)evBox.MyEvent.Parameters["BehaviorSubID"]);
                    }
                    else if (condition == 8)
                    {
                        atkParam = ParamManager.GetPlayerBasicAtkParam(
                            MODEL.DummyPolyMan.IsViewingLeftHandHit ?
                            MODEL.ChrAsm.LeftWeapon : MODEL.ChrAsm.RightWeapon,
                            (int)evBox.MyEvent.Parameters["BehaviorSubID"],
                            isLeftHand: MODEL.DummyPolyMan.IsViewingLeftHandHit);
                    }
                    else if (condition == 2)
                    {
                        atkParam = ParamManager.GetPlayerBasicAtkParam(
                            MODEL.ChrAsm.LeftWeapon,
                            (int)evBox.MyEvent.Parameters["BehaviorSubID"], isLeftHand: true);
                    }
                    else
                    {
                        Console.WriteLine($"Unknown InvokePCBehavior condition: {condition}");
                    }
                }
            }

            return(atkParam);
        }