Exemple #1
0
    public void DisplayNadeFrame(NadeThrowFrame frame)
    {
        for (int i = 0; i < frame.NadeThrows.Count; i++)
        {
            var nadeThrow = frame.NadeThrows[i];
            var nadeClone = Instantiate(NadePrefab);
            nadeClone.GetComponent <NadeGraphics>().NadeThrow = nadeThrow;
            var pos = (nadeThrow.Position / PlaybackScale) - Map.Offset;
            if (PlaybackMode == PlaybackMode.TwoD)
            {
                pos.y = 3;
            }
            nadeClone.transform.position = pos;
            nadeClone.name = nadeThrow.NadeType.ToString() + " - " + nadeThrow.Thrower;

            Destroy(nadeClone, 5);
        }
    }
Exemple #2
0
    public bool AddNadeFrame(DemoParser parser, WeaponFiredEventArgs eventArgs)
    {
        if (eventArgs.Weapon.Class != EquipmentClass.Grenade)
        {
            return(false);
        }

        var nadeThrow = new NadeThrow()
        {
            NadeType  = eventArgs.Weapon.Weapon,
            Thrower   = eventArgs.Shooter.SteamID.ToString(),
            Position  = new Vector3(-eventArgs.Shooter.Position.X, eventArgs.Shooter.Position.Z, -eventArgs.Shooter.Position.Y),
            Direction = DemoInfoHelper.ViewAnglesToVector3(eventArgs.Shooter.ViewDirectionX, eventArgs.Shooter.ViewDirectionY)
        };

        NadeThrowFrame frame = null;

        if (NadeThrowFrames.Count != 0)
        {
            frame = NadeThrowFrames.Last();
        }
        if (frame == null || frame.Tick != parser.CurrentTick)
        {
            frame = new NadeThrowFrame()
            {
                Tick       = parser.CurrentTick,
                Round      = MatchInfoManager.Instance.Rounds.Last().Number,
                NadeThrows = new List <NadeThrow>()
                {
                    nadeThrow
                }
            };
            NadeThrowFrames.Add(frame);
        }
        else
        {
            frame.NadeThrows.Add(nadeThrow);
        }

        return(true);
    }