-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable item actions for multiplayer, fixes #4
- Loading branch information
1 parent
31f4672
commit 5bcfa45
Showing
15 changed files
with
71 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
public class EquipAction : IAction | ||
using ProtoBuf; | ||
|
||
[ProtoContract] | ||
public class EquipAction : IAction | ||
{ | ||
public IItem Item; | ||
public GameEntity Target; | ||
[ProtoMember(1)] | ||
public ItemName Item; | ||
|
||
[ProtoMember(2)] | ||
public EntityReference Entity; | ||
|
||
public bool Validate(GameContext context) | ||
{ | ||
throw new System.NotImplementedException(); | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,24 @@ | ||
public class PickAndEquipAction : IAction | ||
using ProtoBuf; | ||
|
||
[ProtoContract] | ||
public class PickAndEquipAction : IAction | ||
{ | ||
[ProtoMember(1)] | ||
public IntVector2 Position; | ||
public GameEntity Target; | ||
|
||
[ProtoMember(2)] | ||
public EntityReference Entity; | ||
|
||
/// <summary> | ||
/// Entity's position should be the same a the item's position | ||
/// </summary> | ||
/// <param name="context"></param> | ||
/// <returns></returns> | ||
public bool Validate(GameContext context) | ||
{ | ||
throw new System.NotImplementedException(); | ||
if (Entity.GetEntity().position.value != Position) return false; | ||
if (Map.Instance.GetItem(Position) == null) return false; | ||
|
||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
public class SpawnItemAction : IAction | ||
using ProtoBuf; | ||
|
||
[ProtoContract] | ||
public class SpawnItemAction : IAction | ||
{ | ||
public IItem Item; | ||
[ProtoMember(1)] | ||
public ItemName Item; | ||
|
||
[ProtoMember(2)] | ||
public IntVector2 Position; | ||
|
||
public bool Validate(GameContext context) | ||
{ | ||
throw new System.NotImplementedException(); | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
public interface IArmor : IItem | ||
public abstract class Equipment : IItem | ||
{ | ||
public ItemName Name { get; protected set; } | ||
public string Prefab { get; protected set; } | ||
public abstract InventorySlot Slot { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
public interface IItem | ||
{ | ||
ItemName Name { get; } | ||
string Prefab { get; } | ||
InventorySlot Slot { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
public enum ItemName | ||
{ | ||
Unknown = 0, // For protobuf | ||
IronAxe | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters