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
12 changes: 6 additions & 6 deletions Assets/Animation/CoolAnimation.controller
Original file line number Diff line number Diff line change
Expand Up @@ -364,31 +364,31 @@ AnimatorController:
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: Death
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: Put
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: Action
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: Direction
m_Type: 3
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
Expand Down Expand Up @@ -525,7 +525,7 @@ AnimatorStateMachine:
m_Position: {x: 600, y: 300, z: 0}
- serializedVersion: 1
m_State: {fileID: 2719619372482766879}
m_Position: {x: 400, y: 400, z: 0}
m_Position: {x: 470, y: 360, z: 0}
- serializedVersion: 1
m_State: {fileID: -9122630403755595834}
m_Position: {x: 700, y: 400, z: 0}
Expand Down
13 changes: 13 additions & 0 deletions Assets/Prefab/character.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 1991111706524250881}
- component: {fileID: 3842974436686933763}
- component: {fileID: 3345964830931367101}
- component: {fileID: -8915626750319151747}
m_Layer: 5
m_Name: character
m_TagString: Untagged
Expand Down Expand Up @@ -119,3 +120,15 @@ Animator:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!114 &-8915626750319151747
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4224658953871280930}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c3edf77b2c5735244852d35bb471ed04, type: 3}
m_Name:
m_EditorClassIdentifier:
4 changes: 2 additions & 2 deletions Assets/Prefab/panel.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ RectTransform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1, y: 1}
m_Pivot: {x: 0, y: 0}
Expand Down
1 change: 1 addition & 0 deletions Assets/Scenes/game-demo.unity
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
tileObject: {fileID: 4445064752271836034, guid: e5e948cfa5bc30e4ea21e23f816fbf64, type: 3}
characterObject: {fileID: 4224658953871280930, guid: 8adffb436bc09d7488091b3cfb87471f, type: 3}
turnText: {fileID: 956752251}
--- !u!1 &477515213
GameObject:
Expand Down
40 changes: 39 additions & 1 deletion Assets/Src/game/charMove.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

public class charMove : MonoBehaviour
{
int xDiff;
int yDiff;
SpriteRenderer m_image;
Animator animator;
// Start is called before the first frame update
void Start()
{
Expand All @@ -16,8 +20,42 @@ void Update()

}

public void SetView()
void LateUpdate()
{
m_image.size = new Vector2(1,1);
}

public void Set(Sprite texture,RuntimeAnimatorController controller,int xDiff,int yDiff)
{
m_image = GetComponent<SpriteRenderer>();
animator = GetComponent<Animator>();
this.xDiff = xDiff;
this.yDiff = yDiff;

m_image.sprite = texture;
animator.runtimeAnimatorController = controller;
}

public void Act(string command)
{
switch (command.Trim())
{
case "wu":
animator.SetTrigger("Walk");
animator.SetInteger("Direction",12);
break;
case "wr":
animator.SetTrigger("Walk");
animator.SetInteger("Direction",3);
break;
case "wd":
animator.SetTrigger("Walk");
animator.SetInteger("Direction",6);
break;
case "wl":
animator.SetTrigger("Walk");
animator.SetInteger("Direction",9);
break;
}
}
}
3 changes: 0 additions & 3 deletions Assets/Src/game/tileImg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public void ImgChange(string type)
else
{
m_image.sprite = texture[0];
m_image.size = new Vector2(1,1);
}
break;
case "block":
Expand All @@ -53,7 +52,6 @@ public void ImgChange(string type)
else
{
m_image.sprite = texture[1];
m_image.size = new Vector2(1,1);
}
break;
case "item":
Expand All @@ -64,7 +62,6 @@ public void ImgChange(string type)
else
{
m_image.sprite = texture[2];
m_image.size = new Vector2(1,1);
}
break;
}
Expand Down
29 changes: 26 additions & 3 deletions Assets/Src/game/viewManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@
public class viewManager : MonoBehaviour
{
public GameObject tileObject = null;
public GameObject characterObject = null;
public Text turnText = null;
GameObject[,] viewObjList;

GameObject cool;
GameObject hot;

charMove coolSrc;
charMove hotSrc;

Sprite[] texture;
RuntimeAnimatorController[] animators = null;

Expand All @@ -29,7 +33,7 @@ void Update()

}

public void Act(int[,] diff)
public void Act(int[,] diff,string command)
{
if (diff == null) return;

Expand All @@ -41,11 +45,17 @@ public void Act(int[,] diff)
if (diff[a,2] == 2) type = "block";
if (diff[a,2] == 4)
{
//coolの移動関数を呼ぶ
//coolの移動モーション関数を呼ぶ
coolSrc.Act(command);
cool.transform.SetParent(viewObjList[diff[a,0],diff[a,1]].transform);
cool.transform.localPosition = new Vector3(0,0,0);
}
if (diff[a,2] == 5)
{
//hotの移動関数を呼ぶ
//hotの移動モーション関数を呼ぶ
hotSrc.Act(command);
hot.transform.SetParent(viewObjList[diff[a,0],diff[a,1]].transform);
hot.transform.localPosition = new Vector3(0,0,0);
}

viewObjList[diff[a,0],diff[a,1]].GetComponent<tileImg>().ImgChange(type);
Expand Down Expand Up @@ -133,5 +143,18 @@ void ShowMap(int[,] map)
}

//cool,hotを生成しposの位置のオブジェクトの子にする
cool = Instantiate(characterObject);
cool.transform.SetParent(viewObjList[coolPos[0],coolPos[1]].transform);
cool.transform.localScale = new Vector3(1,1,0);
cool.transform.localPosition = new Vector3(0,0,0);
coolSrc = cool.GetComponent<charMove>();
coolSrc.Set(texture[3],animators[1],xSize,ySize);

hot = Instantiate(characterObject);
hot.transform.SetParent(viewObjList[hotPos[0],hotPos[1]].transform);
hot.transform.localScale = new Vector3(1,1,0);
hot.transform.localPosition = new Vector3(0,0,0);
hotSrc = hot.GetComponent<charMove>();
hotSrc.Set(texture[4],animators[2],xSize,ySize);
}
}
3 changes: 2 additions & 1 deletion Assets/Src/global/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ async Task Action(bool isCool)
returnData = mapManager.ActChar(team,recieve);
recieve = await cool.Send(string.Join("",returnData));
returnData = mapManager.ActChar(team,recieve);
viewManager.Act(mapManager.getDifference(),recieve);
recieve = await cool.Send(string.Join("",returnData));
if (recieve == "#\r\n") Debug.Log("OK");
break;
Expand All @@ -206,13 +207,13 @@ async Task Action(bool isCool)
returnData = mapManager.ActChar(team,recieve);
recieve = await hot.Send(string.Join("",returnData));
returnData = mapManager.ActChar(team,recieve);
viewManager.Act(mapManager.getDifference(),recieve);
recieve = await hot.Send(string.Join("",returnData));
if (recieve == "#\r\n") Debug.Log("OK");
break;
}

await Task.Delay(500);
viewManager.Act(mapManager.getDifference());
turn = mapManager.getTurn();
viewManager.SetTurn(turn);

Expand Down
6 changes: 3 additions & 3 deletions Assets/Texture/cool/cool.png.meta

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

4 changes: 2 additions & 2 deletions Assets/Texture/hot/hot.png.meta

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