This repository has been archived by the owner on Oct 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
javierfoe
committed
Aug 23, 2019
1 parent
f08ab0a
commit 9f27d1b
Showing
12 changed files
with
381 additions
and
253 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!1 &490826125789148606 | ||
GameObject: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
serializedVersion: 6 | ||
m_Component: | ||
- component: {fileID: 490826125789148545} | ||
- component: {fileID: 490826125789148544} | ||
- component: {fileID: 490826125789148607} | ||
m_Layer: 0 | ||
m_Name: Jose Delgado | ||
m_TagString: Untagged | ||
m_Icon: {fileID: 0} | ||
m_NavMeshLayer: 0 | ||
m_StaticEditorFlags: 0 | ||
m_IsActive: 1 | ||
--- !u!4 &490826125789148545 | ||
Transform: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 490826125789148606} | ||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||
m_LocalPosition: {x: 0, y: 0, z: 0} | ||
m_LocalScale: {x: 1, y: 1, z: 1} | ||
m_Children: [] | ||
m_Father: {fileID: 0} | ||
m_RootOrder: 0 | ||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||
--- !u!114 &490826125789148544 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 490826125789148606} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: f37253140773b4148bf3983f442a400f, type: 3} | ||
m_Name: | ||
m_EditorClassIdentifier: | ||
syncInterval: 0.1 | ||
characterName: Jose Delgado | ||
characterHP: 4 | ||
--- !u!114 &490826125789148607 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 490826125789148606} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: 9b91ecbcc199f4492b9a91e820070131, type: 3} | ||
m_Name: | ||
m_EditorClassIdentifier: | ||
serverOnly: 0 | ||
localPlayerAuthority: 0 | ||
m_AssetId: 0a862e7a025801c45ad8ce3e4b4d0989 | ||
m_SceneId: 0 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,79 +1,80 @@ | ||
using System.Collections; | ||
using UnityEngine; | ||
namespace PimPamPum | ||
{ | ||
public abstract class Card | ||
{ | ||
private static Color brownCard = Color.red; | ||
|
||
public virtual Suit Suit => Struct.suit; | ||
|
||
public virtual Rank Rank => Struct.rank; | ||
|
||
public bool IsRed => Suit == Suit.Hearts || Suit == Suit.Diamonds; | ||
|
||
public CardStruct Struct | ||
{ | ||
get; protected set; | ||
} | ||
|
||
public virtual Card Original => null; | ||
|
||
public virtual Color Color => brownCard; | ||
|
||
public virtual bool Is<T>() where T : Card, new() | ||
{ | ||
return this is T; | ||
} | ||
|
||
protected void SetSuitRank(Suit suit = Suit.Null, Rank rank = Rank.Null) | ||
{ | ||
Struct = new CardStruct | ||
{ | ||
suit = suit, | ||
rank = rank, | ||
name = ToString(), | ||
color = Color | ||
}; | ||
} | ||
|
||
public virtual void BeginCardDrag(PlayerController pc) | ||
{ | ||
pc.BeginCardDrag(this); | ||
} | ||
|
||
public virtual IEnumerator PlayCard(PlayerController pc, int player, Drop drop, int cardIndex) | ||
{ | ||
yield return CardEvent(pc, player, drop, cardIndex); | ||
yield return CardEffect(pc, player, drop, cardIndex); | ||
yield return CardUsed(pc); | ||
pc.FinishCardUsed(); | ||
} | ||
|
||
protected virtual IEnumerator CardEffect(PlayerController pc, int player, Drop drop, int cardIndex) | ||
{ | ||
pc.DiscardCardUsed(); | ||
yield return null; | ||
} | ||
|
||
protected virtual IEnumerator CardEvent(PlayerController pc, int player, Drop drop, int cardIndex) | ||
{ | ||
yield return GameController.Instance.PimPamPumEventPlayedCard(pc.PlayerNumber, player, this, drop, cardIndex); | ||
} | ||
|
||
public abstract IEnumerator CardUsed(PlayerController pc); | ||
|
||
public Card ConvertTo<T>() where T : Card, new() | ||
{ | ||
Card converted = new T(); | ||
return new ConvertedCard(this, converted); | ||
} | ||
|
||
public static Card CreateNew<T>(Suit suit, Rank rank) where T : Card, new() | ||
{ | ||
Card res = new T(); | ||
res.SetSuitRank(suit, rank); | ||
return res; | ||
} | ||
} | ||
using System.Collections; | ||
using UnityEngine; | ||
|
||
namespace PimPamPum | ||
{ | ||
public abstract class Card | ||
{ | ||
private static Color brownCard = Color.red; | ||
|
||
public virtual Suit Suit => Struct.suit; | ||
|
||
public virtual Rank Rank => Struct.rank; | ||
|
||
public bool IsRed => Suit == Suit.Hearts || Suit == Suit.Diamonds; | ||
|
||
public CardStruct Struct | ||
{ | ||
get; protected set; | ||
} | ||
|
||
public virtual Card Original => null; | ||
|
||
public virtual Color Color => brownCard; | ||
|
||
public virtual bool Is<T>() where T : Card | ||
{ | ||
return this is T; | ||
} | ||
|
||
protected void SetSuitRank(Suit suit = Suit.Null, Rank rank = Rank.Null) | ||
{ | ||
Struct = new CardStruct | ||
{ | ||
suit = suit, | ||
rank = rank, | ||
name = ToString(), | ||
color = Color | ||
}; | ||
} | ||
|
||
public virtual void BeginCardDrag(PlayerController pc) | ||
{ | ||
pc.BeginCardDrag(this); | ||
} | ||
|
||
public virtual IEnumerator PlayCard(PlayerController pc, int player, Drop drop, int cardIndex) | ||
{ | ||
yield return CardEvent(pc, player, drop, cardIndex); | ||
yield return CardEffect(pc, player, drop, cardIndex); | ||
yield return CardUsed(pc); | ||
pc.FinishCardUsed(); | ||
} | ||
|
||
protected virtual IEnumerator CardEffect(PlayerController pc, int player, Drop drop, int cardIndex) | ||
{ | ||
pc.DiscardCardUsed(); | ||
yield return null; | ||
} | ||
|
||
protected virtual IEnumerator CardEvent(PlayerController pc, int player, Drop drop, int cardIndex) | ||
{ | ||
yield return GameController.Instance.PimPamPumEventPlayedCard(pc.PlayerNumber, player, this, drop, cardIndex); | ||
} | ||
|
||
public abstract IEnumerator CardUsed(PlayerController pc); | ||
|
||
public Card ConvertTo<T>() where T : Card, new() | ||
{ | ||
Card converted = new T(); | ||
return new ConvertedCard(this, converted); | ||
} | ||
|
||
public static Card CreateNew<T>(Suit suit, Rank rank) where T : Card, new() | ||
{ | ||
Card res = new T(); | ||
res.SetSuitRank(suit, rank); | ||
return res; | ||
} | ||
} | ||
} |
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,21 +1,22 @@ | ||
using System.Collections; | ||
namespace PimPamPum | ||
{ | ||
public class Missed : Card | ||
{ | ||
protected override IEnumerator CardEffect(PlayerController pc, int player, Drop drop, int cardIndex) | ||
{ | ||
yield return null; | ||
} | ||
|
||
public override IEnumerator CardUsed(PlayerController pc) | ||
{ | ||
yield return GameController.Instance.UsedCard<Missed>(pc); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return "Missed"; | ||
} | ||
} | ||
using System.Collections; | ||
|
||
namespace PimPamPum | ||
{ | ||
public class Missed : Card | ||
{ | ||
protected override IEnumerator CardEffect(PlayerController pc, int player, Drop drop, int cardIndex) | ||
{ | ||
yield return null; | ||
} | ||
|
||
public override IEnumerator CardUsed(PlayerController pc) | ||
{ | ||
yield return GameController.Instance.UsedCard<Missed>(pc); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return "Missed"; | ||
} | ||
} | ||
} |
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,42 +1,43 @@ | ||
using System.Collections; | ||
namespace PimPamPum | ||
{ | ||
public class Barrel : Property, ICondition | ||
{ | ||
public override void BeginCardDrag(PlayerController pc) | ||
{ | ||
base.BeginCardDrag(pc); | ||
pc.SelfTargetPropertyCard<Barrel>(); | ||
} | ||
|
||
public override void AddPropertyEffect(PlayerController pc) | ||
{ | ||
pc.EquipBarrel(); | ||
} | ||
|
||
public override void RemovePropertyEffect(PlayerController pc) | ||
{ | ||
pc.UnequipBarrel(); | ||
} | ||
|
||
public bool CheckCondition(Card c) | ||
{ | ||
return c.Suit == Suit.Hearts; | ||
} | ||
|
||
protected override IEnumerator EquipTrigger(PlayerController pc) | ||
{ | ||
yield return pc.Equip<Barrel>(this); | ||
} | ||
|
||
public override IEnumerator CardUsed(PlayerController pc) | ||
{ | ||
yield return GameController.Instance.UsedCard<Barrel>(pc); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return "Barrel"; | ||
} | ||
} | ||
using System.Collections; | ||
|
||
namespace PimPamPum | ||
{ | ||
public class Barrel : Property, ICondition | ||
{ | ||
public override void BeginCardDrag(PlayerController pc) | ||
{ | ||
base.BeginCardDrag(pc); | ||
pc.SelfTargetPropertyCard<Barrel>(); | ||
} | ||
|
||
public override void AddPropertyEffect(PlayerController pc) | ||
{ | ||
pc.EquipBarrel(); | ||
} | ||
|
||
public override void RemovePropertyEffect(PlayerController pc) | ||
{ | ||
pc.UnequipBarrel(); | ||
} | ||
|
||
public bool CheckCondition(Card c) | ||
{ | ||
return c.Suit == Suit.Hearts; | ||
} | ||
|
||
protected override IEnumerator EquipTrigger(PlayerController pc) | ||
{ | ||
yield return pc.Equip<Barrel>(this); | ||
} | ||
|
||
public override IEnumerator CardUsed(PlayerController pc) | ||
{ | ||
yield return GameController.Instance.UsedCard<Barrel>(pc); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return "Barrel"; | ||
} | ||
} | ||
} |
Oops, something went wrong.