Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vs/Assembly-CSharp-Editor.csproj.dtbcache.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .vs/Assembly-CSharp.csproj.dtbcache.json

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified .vs/CSharpMainProjectMyFork/v17/.suo
Binary file not shown.
282 changes: 282 additions & 0 deletions .vs/CSharpMainProjectMyFork/v17/DocumentLayout.backup.json

Large diffs are not rendered by default.

281 changes: 281 additions & 0 deletions .vs/CSharpMainProjectMyFork/v17/DocumentLayout.json

Large diffs are not rendered by default.

Binary file not shown.
Binary file added .vs/CSharpMainProjectMyFork/v18/.suo
Binary file not shown.
538 changes: 538 additions & 0 deletions .vs/CSharpMainProjectMyFork/v18/DocumentLayout.backup.json

Large diffs are not rendered by default.

538 changes: 538 additions & 0 deletions .vs/CSharpMainProjectMyFork/v18/DocumentLayout.json

Large diffs are not rendered by default.

Binary file not shown.
1 change: 1 addition & 0 deletions .vs/Root.csproj.dtbcache.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .vs/Tests.csproj.dtbcache.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .vs/Tests1.csproj.dtbcache.json

Large diffs are not rendered by default.

44,228 changes: 44,228 additions & 0 deletions Assets/Resources/PlayerUnits/PlayerUnit3 1.prefab

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions Assets/Resources/PlayerUnits/PlayerUnit3 1.prefab.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Assets/Resources/PlayerUnits/PlayerUnit3.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_healthBar: {fileID: 178258570018206233}
_debugPathOutput: {fileID: 0}
--- !u!114 &3664015912038799981
MonoBehaviour:
m_ObjectHideFlags: 0
Expand All @@ -67,10 +68,8 @@ MonoBehaviour:
_maxHealth: 400
_brainUpdateDelay: 0.25
_moveDelay: 0.25
_attackDelay: 0.75
_attackDelay: 0.15
_attackRange: 3.5
_shotsPerTarget: 1
_targetsInVolley: 1
_projectileType: 0
_damage: 15
--- !u!1 &526913648782850647
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scenes/Main.unity
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 705507994}
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
m_IndirectSpecularColor: {r: 0.44657874, g: 0.49641258, b: 0.5748172, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down
6 changes: 4 additions & 2 deletions Assets/Scripts/Controller/BotController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
using Model.Config;
using UnityEngine;
using Utilities;
//hello
//hello!
//How are you?
//i'm fine
//I'm fine
namespace Controller
{
public class BotController
Expand Down Expand Up @@ -74,3 +74,5 @@ private void ChooseUnit()
}
}
}


8 changes: 7 additions & 1 deletion Assets/Scripts/Controller/LevelController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Linq;
using Assets.Scripts.Model.Runtime;
using Model;
using Model.Config;
using Model.Runtime;
Expand All @@ -18,6 +19,8 @@ public class LevelController : IPlayerUnitChoosingListener
private readonly Gameplay3dView _gameplayView;
private readonly Settings _settings;
private readonly TimeUtil _timeUtil;
private readonly UnitManager _playerUnitManager;
private readonly UnitManager _botUnitManager;

public LevelController(RuntimeModel runtimeModel, RootController rootController)
{
Expand All @@ -30,6 +33,9 @@ public LevelController(RuntimeModel runtimeModel, RootController rootController)
_gameplayView = ServiceLocator.Get<Gameplay3dView>();
_settings = ServiceLocator.Get<Settings>();
_timeUtil = ServiceLocator.Get<TimeUtil>();

_playerUnitManager = new UnitManager();
_botUnitManager = new UnitManager();
}

public void StartLevel(int level)
Expand Down Expand Up @@ -72,7 +78,7 @@ private void SpawnUnit(int forPlayer, UnitConfig config)
_runtimeModel.Map.Bases[forPlayer],
_runtimeModel.RoUnits.Select(x => x.Pos).ToHashSet());

var unit = new Unit(config, pos);
var unit = new Unit(config, pos, forPlayer == RuntimeModel.PlayerId ? _playerUnitManager : _botUnitManager);
_runtimeModel.Money[forPlayer] -= config.Cost;
_runtimeModel.PlayersUnits[forPlayer].Add(unit);
}
Expand Down
8 changes: 8 additions & 0 deletions Assets/Scripts/Editor/Editor.Tests.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions Assets/Scripts/Editor/Editor.Tests/Dz2Test.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using Model.Runtime.Projectiles;
using NUnit.Framework;
using UnityEngine;

public class Dz2Test : MonoBehaviour
{
private const int SamplesOverTrajectory = 100;

private const float ProjectileSpeed = 7f;

[Test]
public void TestProjectileTrajectory()
{
TestProjectileTrajectory(Vector2Int.zero, new Vector2Int(100, 0));
TestProjectileTrajectory(Vector2Int.zero, new Vector2Int(0, 100));
TestProjectileTrajectory(Vector2Int.zero, new Vector2Int(100, 100));
TestProjectileTrajectory(new Vector2Int(50, 50), new Vector2Int(100, 100));
}

public void TestProjectileTrajectory(Vector2Int start, Vector2Int target)
{
var proj = new ArchToTileProjectile(null, target, 0, start);

var totalDistance = Vector2.Distance(start, target);
var timeToTarget = totalDistance / ProjectileSpeed;
var maxHeight = 0.6f * totalDistance;

var step = 1f / SamplesOverTrajectory;
var timeStep = timeToTarget / SamplesOverTrajectory;
var totalPassedTime = 0f;
for (float t = 0; t <= 1; t += step)
{
totalPassedTime += timeStep;
proj.Update(timeStep, totalPassedTime);
var height = proj.Height;
var refHeight = maxHeight * (-(t * 2 - 1) * (t * 2 - 1) + 1);

Assert.AreEqual(refHeight, height, 0.1f, "Height is not as expected at t=" + t);
}
}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/Editor/Editor.Tests/Dz2Test.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions Assets/Scripts/Editor/Editor.Tests/Tests.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "Tests1",
"rootNamespace": "",
"references": [
"UnityEngine.TestRunner",
"UnityEditor.TestRunner",
"Root"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": [],
"noEngineReferences": false
}
7 changes: 7 additions & 0 deletions Assets/Scripts/Editor/Editor.Tests/Tests.asmdef.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Assets/Scripts/EnterPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ public class EnterPoint : MonoBehaviour
{
[SerializeField] private Settings _settings;
[SerializeField] private Canvas _targetCanvas;
private float _timeScale = 1;
private float _timeScale = 5;

//������, ����� ���� �!
void Start()
{
Time.timeScale = _timeScale;
Expand Down
3 changes: 2 additions & 1 deletion Assets/Scripts/Model/Runtime/MainBase.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
using Model.Runtime.ReadOnly;
using UnityEngine;

namespace Model.Runtime
{
public class MainBase : IReadOnlyBase
{
public int Health { get; private set; }

public MainBase(int health)
{
Health = health;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,10 @@ protected override void UpdateImpl(float deltaTime, float time)
float localHeight = 0f;
float totalDistance = _totalDistance;

///////////////////////////////////////
// Insert you code here
///////////////////////////////////////
float maxHeight = totalDistance * 0.6f;
localHeight = maxHeight * (-(t * 2 - 1) * (t * 2 - 1) + 1);


///////////////////////////////////////
// End of the code to insert
///////////////////////////////////////

Height = localHeight;
if (time > StartTime + _timeToTarget)
Hit(_target);
Expand Down
8 changes: 8 additions & 0 deletions Assets/Scripts/Model/Runtime/Projectiles/Tests.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "Projectiles.Test",
"rootNamespace": "",
"references": [
"UnityEngine.TestRunner",
"UnityEditor.TestRunner"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": [],
"noEngineReferences": false
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

115 changes: 115 additions & 0 deletions Assets/Scripts/Model/Runtime/ReadOnly/BufferUnitBrain.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
using Model;
using Model.Runtime.ReadOnly;
using System.Collections.Generic;
using Model.Runtime.Projectiles;
using UnitBrains.Player;
using UnityEngine;
using Utilities;
using View;

namespace UnitBrains.Player
{
public class BufferUnitBrain : DefaultPlayerUnitBrain
{
public override string TargetUnitName => "Buffer Unit";
private enum BufferState
{
Moving,
PreBuffPause,
Buffing,
PostBuffPause
}

private BufferState _state = BufferState.Moving;
private float _pauseTimer = 0f;
private const float PauseDuration = 0.5f;
private const float BuffCooldown = 3f;
private float _buffCooldownTimer = 0f;

private IReadOnlyUnit _buffTarget = null;
private VFXView _vfxView;

public override void Update(float deltaTime, float time)
{
if (_vfxView == null)
_vfxView = ServiceLocator.Get<VFXView>();

if (_buffCooldownTimer > 0f)
_buffCooldownTimer -= deltaTime;

switch (_state)
{
case BufferState.Moving:

if (_buffCooldownTimer <= 0f)
{
_buffTarget = FindBuffTarget();
if (_buffTarget != null)
{
_state = BufferState.PreBuffPause;
_pauseTimer = 0f;
}
}
break;

case BufferState.PreBuffPause:

_pauseTimer += deltaTime;
if (_pauseTimer >= PauseDuration)
{
_state = BufferState.Buffing;
}
break;

case BufferState.Buffing:

if (_buffTarget != null)
{
var targetUnit = _buffTarget as Model.Runtime.Unit;
if (targetUnit != null)
{
targetUnit.ApplyBuff();
_vfxView.PlayVFX(_buffTarget.Pos, VFXView.VFXType.BuffApplied);
}
}
_buffTarget = null;
_buffCooldownTimer = BuffCooldown;
_state = BufferState.PostBuffPause;
_pauseTimer = 0f;
break;

case BufferState.PostBuffPause:
_pauseTimer += deltaTime;
if (_pauseTimer >= PauseDuration)
{
_state = BufferState.Moving;
}
break;
}
}

public override Vector2Int GetNextStep()
{
if (_state != BufferState.Moving)
return unit.Pos;

return base.GetNextStep();
}

protected override List<Vector2Int> SelectTargets()
{
return new List<Vector2Int>();
}

private IReadOnlyUnit FindBuffTarget()
{
var allies = GetUnitsInRadius(unit.Config.AttackRange, enemies: false);
foreach (var ally in allies)
{
if (!ally.HasBuff)
return ally;
}
return null;
}
}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/Model/Runtime/ReadOnly/BufferUnitBrain.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading