Skip to content

Commit

Permalink
start.1
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheyca committed Jan 9, 2019
1 parent adb02ef commit 3c2b045
Show file tree
Hide file tree
Showing 13 changed files with 272 additions and 32 deletions.
4 changes: 2 additions & 2 deletions ogtdglib.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.168
# Visual Studio Version 16
VisualStudioVersion = 16.0.28407.52
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ogtdglib", "ogtdglib\ogtdglib.csproj", "{6DC4A171-D8FE-4AE9-9669-A82CAC939CE4}"
EndProject
Expand Down
22 changes: 22 additions & 0 deletions ogtdglib/AmmoTypes/BaseAmmotype.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using DuckGame;
using JetBrains.Annotations;

namespace ogtdglib.AmmoTypes
{
[PublicAPI]
public abstract class BaseAmmotype:AmmoType
{
private Nothing _nothing;

private void InitNothing()
{
if (_nothing is null) _nothing = new Nothing();
}

protected string GetPath(string asset)
{
InitNothing();
return _nothing.GetPath(asset);
}
}
}
6 changes: 0 additions & 6 deletions ogtdglib/Class1.cs

This file was deleted.

61 changes: 61 additions & 0 deletions ogtdglib/ClassDiagram1.cd
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram MajorVersion="1" MinorVersion="1">
<Class Name="ogtdglib.Effects.Effect">
<Position X="6" Y="0.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAABCAAAAAAAAAAAAAAAAAAAAACAAAIAAAAAAAAIA=</HashCode>
<FileName>Effects\Effect.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="ogtdglib.Effects.Effector">
<Position X="7.25" Y="4.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAQBAAAAAAAAAQAAAAAAEAAAAAAAAAAAIAAAAAAAAAA=</HashCode>
<FileName>Effects\Effector.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="ogtdglib.Effects.LinkedEffect">
<Position X="5" Y="3.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAABAAAAAAAAAAAAAAAABAAAAAAAAAAAAEAAAAAAA=</HashCode>
<FileName>Effects\LinkedEffect.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="ogtdglib.Effects.StopEffect">
<Position X="2.5" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAoAAQAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Effects\StopEffect.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="ogtdglib.Nothing" Collapsed="true">
<Position X="8.5" Y="0.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Nothing.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="ogtdglib.AmmoTypes.BaseAmmotype">
<Position X="13.25" Y="2.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAABAAAAAAAAAAAAACABAAAAAAAAAAAAA=</HashCode>
<FileName>AmmoTypes\BaseAmmotype.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="DuckGame.AmmoType" Collapsed="true">
<Position X="13.25" Y="1.75" Width="1.5" />
<TypeIdentifier />
</Class>
<Class Name="DuckGame.Thing" Collapsed="true">
<Position X="8" Y="3" Width="1.5" />
<TypeIdentifier />
</Class>
<Class Name="ogtdglib.Effects.FrictionEffect">
<Position X="2.5" Y="4.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAABAAAgAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Effects\FrictionEffect.cs</FileName>
</TypeIdentifier>
</Class>
<Font Name="Segoe UI" Size="9" />
</ClassDiagram>
27 changes: 27 additions & 0 deletions ogtdglib/Effects/Effect.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using DuckGame;
using JetBrains.Annotations;

namespace ogtdglib.Effects
{
[PublicAPI]
public abstract class Effect
{
public bool Decayed { get; protected set; }
public Thing Owner { get; }
protected uint Ticks { get; private set; }

[PublicAPI]
protected Effect(Thing owner)
{
Owner = owner;
}

public void Step()
{
Ticks += 1;
OnStep();
}

protected abstract void OnStep();
}
}
40 changes: 40 additions & 0 deletions ogtdglib/Effects/Effector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using DuckGame;
using JetBrains.Annotations;

namespace ogtdglib.Effects
{
[PublicAPI]
public sealed class Effector:Thing
{
public Effect ItsEffect;
public StateBinding EffectBinding = new StateBinding(nameof(ItsEffect));

public Effector(Effect itsEffect)
{
ItsEffect = itsEffect;
owner = ItsEffect.Owner;
}

public override void Initialize()
{
Step();
}

public void Step()
{
ItsEffect.Step();
}

public override void Update()
{
if (!ItsEffect.Decayed)
{
ItsEffect.Step();
}
else
{
Level.Remove(this);
}
}
}
}
20 changes: 20 additions & 0 deletions ogtdglib/Effects/FrictionEffect.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using DuckGame;

namespace ogtdglib.Effects
{
public sealed class FrictionEffect:LinkedEffect
{
private readonly float _friction;

public FrictionEffect(Thing owner, Thing linkThing, float friction) : base(owner, linkThing)
{
_friction = friction;
}

protected override void LinkedStep(Thing linkThing)
{
linkThing.hSpeed *= _friction;
linkThing.vSpeed *= _friction;
}
}
}
26 changes: 26 additions & 0 deletions ogtdglib/Effects/LinkedEffect.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using DuckGame;

namespace ogtdglib.Effects
{
public abstract class LinkedEffect:Effect
{
private readonly Thing _linkThing;

protected LinkedEffect(Thing owner, Thing linkThing) : base(owner)
{
_linkThing = linkThing;
}

protected sealed override void OnStep()
{
if (_linkThing == null || _linkThing is MaterialThing materialThing && materialThing._destroyed)
{
Decayed = true;
return;
}
LinkedStep(_linkThing);
}

protected abstract void LinkedStep(Thing linkThing);
}
}
27 changes: 27 additions & 0 deletions ogtdglib/Effects/StopEffect.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using DuckGame;

namespace ogtdglib.Effects
{
public sealed class StopEffect:LinkedEffect
{
private readonly float _x;
private readonly float _y;
private readonly uint _ttd;

public StopEffect(Thing owner, Thing linkThing, uint ttd) : base(owner, linkThing)
{
_x = linkThing.x;
_y = linkThing.y;
_ttd = ttd;
}

protected override void LinkedStep(Thing linkThing)
{
linkThing.hSpeed = 0f;
linkThing.vSpeed = 0f;
linkThing.x = _x;
linkThing.y = _y;
if (Ticks > _ttd) Decayed = true;
}
}
}
11 changes: 11 additions & 0 deletions ogtdglib/Nothing.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using DuckGame;
using JetBrains.Annotations;

namespace ogtdglib
{
[PublicAPI]
public sealed class Nothing:Thing
{

}
}
16 changes: 8 additions & 8 deletions ogtdglib/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
using System.Reflection;
using System.Runtime.CompilerServices;
//using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// Общие сведения об этой сборке предоставляются следующим набором
// набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
// связанные со сборкой.
[assembly: AssemblyTitle("ogtdglib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
//[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("OnGoTeam")]
[assembly: AssemblyProduct("ogtdglib")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyCopyright("Copyright © 2019 OGT")]
//[assembly: AssemblyTrademark("")]
//[assembly: AssemblyCulture("")]

// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
Expand All @@ -32,5 +32,5 @@
// Можно задать все значения или принять номер сборки и номер редакции по умолчанию.
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.0.*")]
[assembly: ObfuscateAssembly(true)]
40 changes: 24 additions & 16 deletions ogtdglib/ogtdglib.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="dglink.csproj" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>6dc4a171-d8fe-4ae9-9669-a82cac939ce4</ProjectGuid>
<ProjectGuid>{6DC4A171-D8FE-4AE9-9669-A82CAC939CE4}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ogtdglib</RootNamespace>
Expand All @@ -32,22 +32,30 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System"/>

<Reference Include="System.Core"/>
<Reference Include="System.Xml.Linq"/>
<Reference Include="System.Data.DataSetExtensions"/>


<Reference Include="Microsoft.CSharp"/>

<Reference Include="System.Data"/>

<Reference Include="System.Xml"/>
<Reference Include="JetBrains.Annotations, Version=2018.2.1.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>..\packages\JetBrains.Annotations.2018.2.1\lib\net20\JetBrains.Annotations.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="AmmoTypes\BaseAmmotype.cs" />
<Compile Include="Effects\FrictionEffect.cs" />
<Compile Include="Effects\LinkedEffect.cs" />
<Compile Include="Nothing.cs" />
<Compile Include="Effects\Effect.cs" />
<Compile Include="Effects\Effector.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Effects\StopEffect.cs" />
</ItemGroup>
<ItemGroup>
<None Include="ClassDiagram1.cd" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
</Project>
4 changes: 4 additions & 0 deletions ogtdglib/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="JetBrains.Annotations" version="2018.2.1" targetFramework="net40" />
</packages>

0 comments on commit 3c2b045

Please sign in to comment.