TELEPORTING HAX
git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1279 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
@@ -23,6 +23,8 @@ namespace OpenRa.Game
|
|||||||
Sidebar sidebar;
|
Sidebar sidebar;
|
||||||
Viewport viewport;
|
Viewport viewport;
|
||||||
|
|
||||||
|
Mcv myUnit;
|
||||||
|
|
||||||
static Size GetResolution(Settings settings)
|
static Size GetResolution(Settings settings)
|
||||||
{
|
{
|
||||||
Size desktopResolution = Screen.PrimaryScreen.Bounds.Size;
|
Size desktopResolution = Screen.PrimaryScreen.Bounds.Size;
|
||||||
@@ -60,7 +62,7 @@ namespace OpenRa.Game
|
|||||||
|
|
||||||
world.Add(new Mcv(24 * new float2(5, 5), 3));
|
world.Add(new Mcv(24 * new float2(5, 5), 3));
|
||||||
world.Add(new Mcv(24 * new float2(7, 5), 2));
|
world.Add(new Mcv(24 * new float2(7, 5), 2));
|
||||||
world.Add(new Mcv(24 * new float2(9, 5), 1));
|
world.Add(myUnit = new Mcv(24 * new float2(9, 5), 1));
|
||||||
|
|
||||||
world.Add(new Refinery(24 * new float2(5, 7), 1));
|
world.Add(new Refinery(24 * new float2(5, 7), 1));
|
||||||
|
|
||||||
@@ -82,13 +84,19 @@ namespace OpenRa.Game
|
|||||||
{
|
{
|
||||||
base.OnMouseDown(e);
|
base.OnMouseDown(e);
|
||||||
lastPos = new float2(e.Location);
|
lastPos = new float2(e.Location);
|
||||||
|
|
||||||
|
if (e.Button == MouseButtons.Left)
|
||||||
|
{
|
||||||
|
MoveOrder order = new MoveOrder(lastPos + viewport.Location);
|
||||||
|
myUnit.Accept(order);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnMouseMove(MouseEventArgs e)
|
protected override void OnMouseMove(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnMouseMove(e);
|
base.OnMouseMove(e);
|
||||||
|
|
||||||
if (e.Button != 0)
|
if (e.Button == MouseButtons.Right)
|
||||||
{
|
{
|
||||||
float2 p = new float2(e.Location);
|
float2 p = new float2(e.Location);
|
||||||
viewport.Scroll(lastPos - p);
|
viewport.Scroll(lastPos - p);
|
||||||
|
|||||||
@@ -29,5 +29,11 @@ namespace OpenRa.Game
|
|||||||
return new Sprite[] { UnitSheetBuilder.sprites[GetFacing() + mcvRange.Value.Start] };
|
return new Sprite[] { UnitSheetBuilder.sprites[GetFacing() + mcvRange.Value.Start] };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Accept(MoveOrder o)
|
||||||
|
{
|
||||||
|
// HACK HACK HACK TELEPORT
|
||||||
|
this.location = o.Destination;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
16
OpenRa.Game/MoveOrder.cs
Normal file
16
OpenRa.Game/MoveOrder.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OpenRa.Game
|
||||||
|
{
|
||||||
|
class MoveOrder
|
||||||
|
{
|
||||||
|
public readonly float2 Destination;
|
||||||
|
|
||||||
|
public MoveOrder(float2 destination)
|
||||||
|
{
|
||||||
|
this.Destination = destination;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -43,6 +43,7 @@
|
|||||||
<Compile Include="Actor.cs" />
|
<Compile Include="Actor.cs" />
|
||||||
<Compile Include="Clock.cs" />
|
<Compile Include="Clock.cs" />
|
||||||
<Compile Include="float2.cs" />
|
<Compile Include="float2.cs" />
|
||||||
|
<Compile Include="MoveOrder.cs" />
|
||||||
<Compile Include="Region.cs" />
|
<Compile Include="Region.cs" />
|
||||||
<Compile Include="SheetBuilder.cs" />
|
<Compile Include="SheetBuilder.cs" />
|
||||||
<Compile Include="HardwarePalette.cs" />
|
<Compile Include="HardwarePalette.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user