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;
z -= d;

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

Binary file not shown.

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

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