示例#1
0
        /// <summary>
        ///     Gets if this <see cref="LogicGameObject"/> instance is alive.
        /// </summary>
        public virtual bool IsAlive()
        {
            LogicHitpointComponent hitpointComponent = this.GetHitpointComponent();

            if (hitpointComponent != null)
            {
                return(hitpointComponent.InternalGetHp() > 0);
            }

            return(true);
        }
示例#2
0
        /// <summary>
        ///     Gets the checksum of this instance.
        /// </summary>
        public virtual void GetChecksum(ChecksumHelper checksum, bool includeGameObjects)
        {
            if (includeGameObjects)
            {
                checksum.StartObject("LogicGameObject");

                checksum.WriteValue("type", this.GetGameObjectType());
                checksum.WriteValue("globalID", this._globalId);
                checksum.WriteValue("dataGlobalID", this._data.GetGlobalID());
                checksum.WriteValue("x", this.GetX());
                checksum.WriteValue("y", this.GetY());
                checksum.WriteValue("seed", this._seed);

                if (this.GetHitpointComponent() != null)
                {
                    LogicHitpointComponent hitpointComponent = this.GetHitpointComponent();

                    checksum.WriteValue("m_hp", hitpointComponent.InternalGetHp());
                    checksum.WriteValue("m_maxHP", hitpointComponent.InternalGetMaxHp());
                }

                checksum.EndObject();
            }
        }