Esempio n. 1
0
    public UnitActionProto ConvertToProto()
    {
        UnitActionProto pd = new UnitActionProto();

        pd.roleID = roleID;
        pd.idleState = idleState;

        return pd;
    }
Esempio n. 2
0
    public void Parse(UnitActionProto proto)
    {
        roleID = proto.roleID;
        idleState = proto.idleState;

        StateList.Clear();
        foreach (var actionStateProto in proto.actions)
        {
            ActionStateHeader ash = new ActionStateHeader();
            ash.Parse(actionStateProto);

            StateList.Add(ash);
        }

        DefList.Clear();
        foreach (var attackDefProto in proto.atkDefList)
        {
            AttackDefHeader adh = new AttackDefHeader();
            adh.Parse(attackDefProto);

            DefList.Add(adh);
        }
    }
Esempio n. 3
0
    public static int FindActionIndex(UnitActionProto data, int stateId)
    {
        if (data == null)
            return -1;

        for (int i = 0; i < data.actions.Count; ++i)
        {
            if (data.actions[i].stateID == stateId)
            {
                return i;
            }
        }

        return -1;
    }