Represents a character attachment, obtained via CryEngine.EntityBase.GetAttachment(int, int) and CryEngine.EntityBase.GetAttachment(string, int).
Example #1
0
        private void Reset(bool enteringGame)
        {
            LoadObject("objects/tanks/tank_generic_" + Team + ".cdf");

            if(Network.IsServer)
            {
                string turretType;

                if (string.IsNullOrEmpty(ForceTankType))
                    turretType = TurretTypes[SinglePlayer.Selector.Next(TurretTypes.Count)].FullName;
                else
                    turretType = "CryGameCode.Tanks." + ForceTankType;

                if (IsLocalClient)
                    NetReset(enteringGame, turretType);

                Network.RemoteInvocation(NetReset, NetworkTarget.ToAllClients | NetworkTarget.NoLocalCalls, enteringGame, turretType);
            }

            m_leftTrack = GetAttachment("track_left");
            m_rightTrack = GetAttachment("track_right");

            // Unhide just in case
            Hide(false);

            Physics.AutoUpdate = false;
            Physics.Type = PhysicalizationType.Living;
            Physics.Mass = 500;
            Physics.HeightCollider = 1.2f;
            Physics.Slot = 0;
            Physics.UseCapsule = false;
            Physics.SizeCollider = new Vec3(2.2f, 2.2f, 0.2f);
            Physics.FlagsOR = PhysicalizationFlags.MonitorPostStep;
            Physics.MaxClimbAngle = MathHelpers.DegreesToRadians(30);
            Physics.AirControl = 0.0f;
            Physics.Save();

            InitHealth(100);

            BoostTime = maxBoostTime;
            SpeedMultiplier = 2;
            BackwardsSpeedMultiplier = 1.5f;

            ReceiveUpdates = true;
        }
Example #2
0
        internal static Attachment TryAdd(IntPtr ptr)
        {
            if (ptr == IntPtr.Zero)
                return null;

            var attachment = Attachments.FirstOrDefault(x => x.Handle == ptr);
            if (attachment == null)
            {
                attachment = new Attachment(ptr);

                Attachments.Add(attachment);
            }

            return attachment;
        }
Example #3
0
        internal static Attachment TryAdd(IntPtr ptr, EntityBase owner)
        {
            if (ptr == IntPtr.Zero)
                return null;

            var attachment = ScriptManager.Instance.Find<Attachment>(ScriptType.Entity, x => x.AttachmentHandle == ptr);
            if (attachment != null)
                return attachment;

            attachment = new Attachment(ptr, owner);

            return attachment;
        }