コード例 #1
0
ファイル: PlayerData.cs プロジェクト: CyberGW/Daemon
    /// <summary>
    /// Takes a <see cref="SpecialMove"/> and converts it to a <see cref="SaveData.SpecialMoveSaveData"/> format for serialization.
    /// </summary>
    /// <param name="move"> <see cref="SpecialMove"/> insatnce to serialize. </param>
    /// <returns> Serializable <see cref="SaveData.SpecialMoveSaveData"/> for saving.</returns>
    public SaveData.SpecialMoveSaveData SpecialMoveToSerializable(SpecialMove move)
    {
        SaveData.SpecialMoveSaveData moveToSave = new SaveData.SpecialMoveSaveData
        {
            typeOfSpecialMove = move.GetType().ToString(),
            text    = move.Text,
            desc    = move.Desc,
            magic   = move.Magic,
            special = move.Special
        };

        return(moveToSave);
    }
コード例 #2
0
        public bool DoSpecialMoveByType(Type NewMove, bool forceMove)
        {
            if (SpecialMove != null && NewMove == SpecialMove.GetType())
            {
                // ignore redundant calls to the same move
                NLogger.Instance.WriteString(LogType.Debug, "[SM] ignoring redundant call.");
                return(false);
            }

            SpecialMoveBase NewMoveInstance = null;

            if (NewMove != null)
            {
                NewMoveInstance = Activator.CreateInstance(NewMove, new object[] { this }) as SpecialMoveBase;
            }
            return(DoSpecialMove(NewMoveInstance, forceMove));
        }