Compare commits

...

2 Commits
1.0 ... master

@ -53,7 +53,7 @@ public class CameraOrbit : MonoBehaviour
} }
} }
else if (Input.GetMouseButton(0)) else if (Input.GetMouseButton(0) && canScroll)
{ {
var d = Input.GetAxis("Mouse Y") * ySpeed * 0.0005f; var d = Input.GetAxis("Mouse Y") * ySpeed * 0.0005f;
z -= d; z -= d;

@ -24,7 +24,6 @@ public class Main : MonoBehaviour
public Dictionary<string, List<string>> attachmentAssetsNames = new Dictionary<string, List<string>>(); public Dictionary<string, List<string>> attachmentAssetsNames = new Dictionary<string, List<string>>();
public Dictionary<string, string> charaWeapon = new Dictionary<string, string>(); public Dictionary<string, string> charaWeapon = new Dictionary<string, string>();
public Dictionary<string, string> attachmentPosition = new Dictionary<string, string>(); public Dictionary<string, string> attachmentPosition = new Dictionary<string, string>();
public float speed;
#endregion #endregion
void Start() void Start()
@ -35,7 +34,6 @@ public class Main : MonoBehaviour
loadCharaCSV(); loadCharaCSV();
loadWeaponCSV(); loadWeaponCSV();
loadAttachmentCSV(); loadAttachmentCSV();
speed = 1.0f;
GameObject.Find("charaDropdown").GetComponent<Dropdown>().value = 14; GameObject.Find("charaDropdown").GetComponent<Dropdown>().value = 14;
} }
@ -248,6 +246,7 @@ public class Main : MonoBehaviour
#region Animator #region Animator
public void loadAnimator(int i) public void loadAnimator(int i)
{ {
if (weapon != null) Destroy(weapon);
if (i == 0) if (i == 0)
{ {
chara.GetComponent<Animator>().runtimeAnimatorController = originAnimator; chara.GetComponent<Animator>().runtimeAnimatorController = originAnimator;
@ -345,11 +344,11 @@ public class Main : MonoBehaviour
#region Action #region Action
public void setState(int i) public void setState(int i)
{ {
if (i != 1) removeWeapon(); setTrigger("EventStep");
if (i == 2 || i == 3) chara.transform.rotation = Quaternion.Euler(0, 180, 0); if (i == 6) removeWeapon();
else chara.transform.rotation = Quaternion.Euler(0, 0, 0); if (i == 2 || i == 3) rotate180();
if (chara.GetComponent<Animator>() != null) else rotate0();
chara.GetComponent<Animator>().SetInteger(Animator.StringToHash("State"), i); SetInteger("State", i);
} }
public void setRoom(int i) public void setRoom(int i)
@ -404,9 +403,24 @@ public class Main : MonoBehaviour
setTrigger(names[i]); setTrigger(names[i]);
} }
public void setBattleStartBoss()
{
rotate180();
setTrigger("BattleStartBoss");
setTrigger("EventStep");
}
public void setBattleStartPlayer()
{
rotate180();
setTrigger("BattleStartPlayer");
setTrigger("EventStep");
Invoke("EventStep", 0.2f);
//Invoke("EventStep", 5f);
}
public void setSpeed(float value) public void setSpeed(float value)
{ {
speed = value;
if (chara.GetComponent<Animator>() != null) if (chara.GetComponent<Animator>() != null)
chara.GetComponent<Animator>().speed = value; chara.GetComponent<Animator>().speed = value;
if (weapon && weapon.GetComponent<Animator>() != null) if (weapon && weapon.GetComponent<Animator>() != null)
@ -434,6 +448,18 @@ public class Main : MonoBehaviour
weaponR.GetComponent<Animator>().SetTrigger(Animator.StringToHash(triggerName)); weaponR.GetComponent<Animator>().SetTrigger(Animator.StringToHash(triggerName));
} }
void SetInteger(string triggerName, int value)
{
if (chara.GetComponent<Animator>() != null)
chara.GetComponent<Animator>().SetInteger(Animator.StringToHash(triggerName), value);
if (weapon && weapon.GetComponent<Animator>() != null)
weapon.GetComponent<Animator>().SetInteger(Animator.StringToHash(triggerName), value);
if (weaponL && weaponL.GetComponent<Animator>() != null)
weaponL.GetComponent<Animator>().SetInteger(Animator.StringToHash(triggerName), value);
if (weaponR && weaponR.GetComponent<Animator>() != null)
weaponR.GetComponent<Animator>().SetInteger(Animator.StringToHash(triggerName), value);
}
void setFloat(string triggerName, float value) void setFloat(string triggerName, float value)
{ {
if (chara.GetComponent<Animator>() != null) if (chara.GetComponent<Animator>() != null)
@ -457,6 +483,25 @@ public class Main : MonoBehaviour
if (weaponR && weaponR.GetComponent<Animator>() != null) if (weaponR && weaponR.GetComponent<Animator>() != null)
weaponR.GetComponent<Animator>().SetBool(Animator.StringToHash(triggerName), value); weaponR.GetComponent<Animator>().SetBool(Animator.StringToHash(triggerName), value);
} }
void EventStep()
{
setTrigger("EventStep");
}
void rotate180()
{
chara.transform.rotation = Quaternion.Euler(0, 180, 0);
if (weapon != null) weapon.transform.rotation = Quaternion.Euler(0, 180, 0);
if (attachment != null) attachment.transform.rotation = Quaternion.Euler(0, 180, 0);
}
void rotate0()
{
chara.transform.rotation = Quaternion.Euler(0, 0, 0);
if (weapon != null) weapon.transform.rotation = Quaternion.Euler(0, 0, 0);
if (attachment != null) attachment.transform.rotation = Quaternion.Euler(0, 0, 0);
}
#endregion #endregion
@ -480,6 +525,8 @@ public class Main : MonoBehaviour
else if (Input.GetKeyDown(KeyCode.F)) setAttack(3); else if (Input.GetKeyDown(KeyCode.F)) setAttack(3);
else if (Input.GetKeyDown(KeyCode.G)) setAttack(4); else if (Input.GetKeyDown(KeyCode.G)) setAttack(4);
else if (Input.GetKeyDown(KeyCode.X)) setDamage(); else if (Input.GetKeyDown(KeyCode.X)) setDamage();
else if (Input.GetKeyDown(KeyCode.J)) setBattleStartPlayer();
else if (Input.GetKeyDown(KeyCode.K)) setBattleStartBoss();
else if (Input.GetKeyDown(KeyCode.Space)) else if (Input.GetKeyDown(KeyCode.Space))
GameObject.Find("stopbutton").GetComponent<Button>().onClick.Invoke(); GameObject.Find("stopbutton").GetComponent<Button>().onClick.Invoke();
else if (Input.GetKeyDown(KeyCode.Z)) else if (Input.GetKeyDown(KeyCode.Z))
@ -502,6 +549,5 @@ public class Main : MonoBehaviour
block.SetVector("_DecalTex_ST", new Vector4(1f, 1f, u, v)); block.SetVector("_DecalTex_ST", new Vector4(1f, 1f, u, v));
charaFaceRender.SetPropertyBlock(block); charaFaceRender.SetPropertyBlock(block);
} }
} }
} }

Binary file not shown.

@ -8,7 +8,8 @@ using UnityEngine.UI;
public class UIFunction : MonoBehaviour public class UIFunction : MonoBehaviour
{ {
Main main; Main main;
float speed; float originSpeed= 1.0f;
float speed = 1.0f;
void Start() void Start()
{ {
@ -100,9 +101,17 @@ public class UIFunction : MonoBehaviour
main.setAttack(i); main.setAttack(i);
} }
public void actionBattleStart(int i)
{
if (i == 0) main.setBattleStartPlayer();
else main.setBattleStartBoss();
}
public void actionSpeed(float i) public void actionSpeed(float i)
{ {
main.setSpeed(i); main.setSpeed(i);
originSpeed = i;
speed = i;
} }
public void actionSpeedInput(string i) public void actionSpeedInput(string i)
@ -110,25 +119,23 @@ public class UIFunction : MonoBehaviour
float s = 1.0f; float s = 1.0f;
float.TryParse(i, out s); float.TryParse(i, out s);
main.setSpeed(s); main.setSpeed(s);
originSpeed = s;
speed = s;
} }
public void actionStop() public void actionStop()
{ {
if (main.speed >= 0.01f) if (speed != 0f)
{ {
speed = main.speed; speed = 0f;
main.setSpeed(0f); main.setSpeed(0f);
} }
else else
{ {
main.setSpeed(speed); main.setSpeed(originSpeed);
speed = originSpeed;
} }
} }
#endregion #endregion
} }

@ -1,6 +1,7 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
public class UIHideshow : MonoBehaviour public class UIHideshow : MonoBehaviour
{ {
@ -19,5 +20,7 @@ public class UIHideshow : MonoBehaviour
{ {
GetComponent<CanvasGroup>().alpha = 0; GetComponent<CanvasGroup>().alpha = 0;
GameObject.Find("Main Camera").GetComponent<CameraOrbit>().canScroll = true; GameObject.Find("Main Camera").GetComponent<CameraOrbit>().canScroll = true;
foreach (var dd in GameObject.Find("LeftUI").GetComponentsInChildren<Dropdown>())
dd.Hide();
} }
} }
Loading…
Cancel
Save