Пример #1
0
 public void FromPrefabs(CharacterEditorData dt)
 {
     this.id                  = dt.m_id;
     this.default_name        = dt.m_defaultName;
     this.description         = dt.description;
     this.resource_id         = dt.m_resID;
     this.scale               = dt.m_scale;
     this.walk_speed_x        = dt.m_walkSpeedX;
     this.walk_speed_y        = dt.m_walkSpeedY;
     this.Hatred              = dt.m_hatred;
     this.low_fire_angle      = dt.m_lowFireAngle;
     this.high_fire_angle     = dt.m_higFireAngle;
     this.fire_range          = dt.m_fireRange;
     this.WeaponPosition      = dt.m_weaponPosition;
     this.be_attack_box_max_x = dt.m_beAttackBoxMaxX;
     this.be_attack_box_max_y = dt.m_beAttackBoxMaxY;
     this.be_attack_box_min_x = dt.m_beAttackBoxMinX;
     this.be_attack_box_min_y = dt.m_beAttackBoxMinY;
     foreach (CharacterEditorData.CharacterEditorStateData editStateDt in dt.m_lsStates)
     {
         CharacterStateData pData = DataBase.CreateInstance <CharacterStateData>();
         pData.FromPrefabs(editStateDt);
         this.Actions[editStateDt.m_stateType] = pData;
     }
 }
Пример #2
0
        public override void FromXml(XmlElement xml)
        {
            XmlRead.Attr(xml, "id", ref id);
            XmlRead.Attr(xml, "default_name", ref default_name);
            XmlRead.Attr(xml, "description", ref description);
            XmlRead.Attr(xml, "resource_id", ref resource_id);
            XmlRead.Attr(xml, "scale", ref scale);
            XmlRead.Attr(xml, "walk_speed_x", ref walk_speed_x);
            XmlRead.Attr(xml, "walk_speed_y", ref walk_speed_y);
            XmlRead.Attr(xml, "low_fire_angle", ref low_fire_angle);
            XmlRead.Attr(xml, "high_fire_angle", ref high_fire_angle);
            XmlRead.Attr(xml, "fire_range", ref fire_range);
            int weapon_pos_x = 0;

            XmlRead.Attr(xml, "weapon_pos_x", ref weapon_pos_x);
            int weapon_pos_y = 0;

            XmlRead.Attr(xml, "weapon_pos_y", ref weapon_pos_y);
            WeaponPosition = new Vector2(weapon_pos_x, weapon_pos_y);

            XmlRead.Attr(xml, "be_attack_box_min_x", ref be_attack_box_min_x);
            XmlRead.Attr(xml, "be_attack_box_min_y", ref be_attack_box_min_y);
            XmlRead.Attr(xml, "be_attack_box_max_x", ref be_attack_box_max_x);
            XmlRead.Attr(xml, "be_attack_box_max_y", ref be_attack_box_max_y);
            XmlRead.Attr(xml, "self_skill", ref self_skill);
            XmlRead.Attr(xml, "m_iHP", ref m_iHP);
            XmlRead.Attr(xml, "m_iMoveEnergy", ref m_iMoveEnergy);
            XmlRead.Attr(xml, "m_iAddEnergy", ref m_iAddEnergy);

            XmlNodeList xmlList = xml.GetElementsByTagName("state");

            foreach (XmlNode node in xmlList)
            {
                XmlElement         ele   = node as XmlElement;
                CharacterStateData pData = DataBase.CreateInstance <CharacterStateData>();
                pData.FromXml(ele);
                CharacterStateType eType = CharacterStateType.UNDEFINE;
                XmlRead.AttrEnum <CharacterStateType>(ele, "state_type", ref eType);
                if (Actions.ContainsKey(eType))
                {
                    LOG.Error("repeat state[" + eType.ToString() + "] in same instruction[" + id + "]");
                }
                else
                {
                    Actions[eType] = pData;
                }
            }
        }
Пример #3
0
        public void UnInitialize()
        {
            m_iHP           = 0;
            m_iFireAngle    = 0;
            m_iCurrentAngle = 0;

            m_pCurrentStateData = null;
            m_pInstructionData  = null;
            m_eCurrentStateType = CharacterStateType.UNDEFINE;
            m_iCurrentFrame     = 0;

            m_iFacing        = GameDefine.FACING_RIGHT;
            m_iDirectionKeys = 0;
            m_iMoveEnergy    = 0;
            m_iAddEnergy     = 0;

            m_icanattackmin = 0;
            m_icanattackmax = 0;

            EmojiID   = 0;
            MessageID = 0;
        }