summaryrefslogtreecommitdiff
path: root/SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2022-04-28 13:58:20 +0800
committerchai <chaifix@163.com>2022-04-28 13:58:20 +0800
commit88a6b32e792910e11451da18eb5fb8c103235842 (patch)
treee64c5feaf46b7d06ae096e3719515c0cafc74dc5 /SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts
parent072f02678d2c5d0d79f49e923b111c4a28da3f69 (diff)
+misc
Diffstat (limited to 'SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts')
-rw-r--r--SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/Actions.cs91
-rw-r--r--SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/Actions.cs.meta12
-rw-r--r--SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/CharacterViewer.cs54
-rw-r--r--SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/CharacterViewer.cs.meta12
-rw-r--r--SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/Ui_Char_Panel.cs106
-rw-r--r--SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/Ui_Char_Panel.cs.meta12
6 files changed, 287 insertions, 0 deletions
diff --git a/SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/Actions.cs b/SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/Actions.cs
new file mode 100644
index 0000000..ae31627
--- /dev/null
+++ b/SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/Actions.cs
@@ -0,0 +1,91 @@
+using UnityEngine;
+using System.Collections;
+//This script executes commands to change character animations
+[RequireComponent (typeof (Animator))]
+public class Actions : MonoBehaviour {
+
+ private Animator animator;
+ void Awake () {
+ animator = GetComponent<Animator> ();
+ }
+
+ public void Dead1()
+ {
+ animator.SetBool ("ACS_Dead1", true);
+ }
+ public void Dead2()
+ {
+ animator.SetBool ("ACS_Dead2", true);
+ }
+ public void Dead3()
+ {
+ animator.SetBool ("ACS_Dead3", true);
+ }
+ public void Dead4()
+ {
+ animator.SetBool ("ACS_Dead4", true);
+ }
+ public void StrafeLeft()
+ {
+ animator.SetBool ("ACS_StrafeLeft", true);
+ }
+ public void StrafeRight()
+ {
+ animator.SetBool ("ACS_StrafeRight", true);
+ }
+ public void Idle()
+ {
+ animator.SetBool ("ACS_Idle", true);
+ }
+ public void Idle2()
+ {
+ animator.SetBool ("ACS_Idle2", true);
+ }
+ public void Attack()
+ {
+ animator.SetBool ("ACS_Attack", true);
+ }
+ public void TurnLeft()
+ {
+ animator.SetBool ("ACS_TurnLeft", true);
+ }
+ public void TurnRight()
+ {
+ animator.SetBool ("ACS_TurnRight", true);
+ }
+ public void ChangeToWalk()
+ {
+ animator.SetBool ("ACS_ChangeToWalk", true);
+ }
+ public void ChangeToWeels()
+ {
+ animator.SetBool ("ACS_ChangeToWeels", true);
+ }
+ public void MoveWeelsForwad()
+ {
+ animator.SetBool ("ACS_MoveWeelsForwad", true);
+ }
+ public void MoveWeelsForwad2()
+ {
+ animator.SetBool ("ACS_MoveWeelsForwad2", true);
+ }
+ public void MoveWeelsBack()
+ {
+ animator.SetBool ("ACS_MoveWeelsBack", true);
+ }
+ public void WalkForwad()
+ {
+ animator.SetBool ("ACS_WalkForwad", true);
+ }
+ public void WalkForwad2()
+ {
+ animator.SetBool ("ACS_WalkForwad2", true);
+ }
+ public void WalkBack()
+ {
+ animator.SetBool ("ACS_WalkBack", true);
+ }
+
+
+
+}
diff --git a/SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/Actions.cs.meta b/SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/Actions.cs.meta
new file mode 100644
index 0000000..51b8a32
--- /dev/null
+++ b/SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/Actions.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 4cbe0be2ea56da24ba23a8799f1ff5cb
+timeCreated: 1481781413
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/CharacterViewer.cs b/SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/CharacterViewer.cs
new file mode 100644
index 0000000..960734a
--- /dev/null
+++ b/SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/CharacterViewer.cs
@@ -0,0 +1,54 @@
+using UnityEngine;
+using System.Collections;
+using UnityEngine.UI;
+
+public class CharacterViewer : MonoBehaviour {
+ //Script control of the camera in the table animation
+ public Transform cameras;
+
+ public Transform targetForCamera;
+ Vector3 deltaPosition;
+ Vector3 lastPosition = Vector3.zero;
+ bool rotating = false;
+
+ void Awake () {
+ deltaPosition = cameras.position - targetForCamera.position;
+ deltaPosition = new Vector3(deltaPosition.x, deltaPosition.y - (-0.1f) * 5, deltaPosition.z +(-0.1f) * 8);
+ transform.Rotate(0, -300f * -170 / Screen.width, 0);
+ }
+
+ void Update () {
+ if (Input.GetMouseButtonDown (0) && Input.mousePosition.x > Screen.width*0.25 ) {
+ lastPosition = Input.mousePosition;
+ rotating = true;
+ }
+
+ if (Input.GetMouseButtonUp(0))
+ rotating = false;
+
+ if (rotating && Input.GetMouseButton(0))
+ {
+ transform.Rotate(0, -300f * (Input.mousePosition - lastPosition).x / Screen.width, 0);
+
+ }
+
+ if (Input.GetAxis("Mouse ScrollWheel")!=0)
+ {
+
+ var y = 0f;
+ if (Input.GetAxis("Mouse ScrollWheel") < 0 && deltaPosition.y < 18) y = Input.GetAxis("Mouse ScrollWheel");
+ if (Input.GetAxis("Mouse ScrollWheel") > 0 && deltaPosition.y > 10f) y = Input.GetAxis("Mouse ScrollWheel");
+ deltaPosition = new Vector3(deltaPosition.x, deltaPosition.y - y * 5, deltaPosition.z + y * 8);
+ }
+
+
+ lastPosition = Input.mousePosition;
+ }
+
+ void LateUpdate () {
+ cameras.position += (targetForCamera.position + deltaPosition - cameras.position) * Time.unscaledDeltaTime * 5;
+ Vector3 relativePos = targetForCamera.position - cameras.position;
+ Quaternion rotation = Quaternion.LookRotation(relativePos);
+ cameras.rotation = rotation;
+ }
+}
diff --git a/SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/CharacterViewer.cs.meta b/SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/CharacterViewer.cs.meta
new file mode 100644
index 0000000..48dc4ac
--- /dev/null
+++ b/SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/CharacterViewer.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: e6cce8297941c7f46a6a6d032e39174c
+timeCreated: 1481781414
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/Ui_Char_Panel.cs b/SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/Ui_Char_Panel.cs
new file mode 100644
index 0000000..0904d93
--- /dev/null
+++ b/SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/Ui_Char_Panel.cs
@@ -0,0 +1,106 @@
+using UnityEngine;
+using UnityEngine.UI;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+//creates the buttons on panel of animations
+public class Ui_Char_Panel : MonoBehaviour {
+
+ public GameObject character;
+ public Transform acts_table;
+ public Button buttonPrefab;
+
+ Button sel_btm;
+
+ Actions actions;
+
+
+ void Start () {
+
+ actions = character.GetComponent<Actions> ();
+
+
+
+ CreateActionButton("Idle");
+ CreateActionButton("Idle2");
+
+ CreateActionButton("Attack");
+
+ CreateActionButton("WalkForwad");
+ CreateActionButton("WalkForwad2");
+ CreateActionButton("WalkBack");
+ CreateActionButton("TurnLeft");
+ CreateActionButton("TurnRight");
+ CreateActionButton("StrafeLeft");
+ CreateActionButton("StrafeRight");
+
+
+
+ CreateActionButton("ChangeToWeels");
+ CreateActionButton("MoveWeelsForwad");
+ CreateActionButton("MoveWeelsForwad2");
+ CreateActionButton("MoveWeelsBack");
+ CreateActionButton("ChangeToWalk");
+
+ CreateActionButton("Dead1");
+ CreateActionButton("Dead2");
+ CreateActionButton("Dead3");
+ CreateActionButton("Dead4");
+
+
+
+
+ }
+
+
+
+ void CreateActionButton(string name) {
+ CreateActionButton(name, name);
+ }
+
+ void CreateActionButton(string name, string message) {
+
+ Button button = CreateButton (name, acts_table);
+
+ if (name == "Idle")
+ {
+ sel_btm = button;
+ button.GetComponentInChildren<Image>().color = new Color(.5f, .5f, .5f);
+ }
+ button.GetComponentInChildren<Text>().fontSize = 12;
+ button.onClick.AddListener(() => actions.SendMessage(message, SendMessageOptions.DontRequireReceiver));
+ button.onClick.AddListener(() => select_btm(button) );
+
+
+ }
+ void select_btm(Button btm)
+ {
+ sel_btm.GetComponentInChildren<Image>().color = new Color(.345f, .345f, .345f);
+ btm.GetComponentInChildren<Image>().color = new Color(.5f, .5f, .5f);
+ sel_btm = btm;
+ }
+
+
+ Button CreateButton(string name, Transform group) {
+ GameObject obj = (GameObject) Instantiate (buttonPrefab.gameObject);
+ obj.name = name;
+ obj.transform.SetParent(group);
+ obj.transform.localScale = Vector3.one;
+ Text text = obj.transform.GetChild (0).GetComponent<Text> ();
+ text.text = name;
+ return obj.GetComponent<Button> ();
+ }
+
+
+
+ public void GetUpgraid()
+ {
+ Application.OpenURL("https://www.assetstore.unity3d.com/#!/content/88937");
+ }
+
+ public void OpenPublisherPage() {
+ Application.OpenURL ("https://connect.unity.com/u/58c9250f32b30600230f64fa");
+ }
+
+
+}
diff --git a/SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/Ui_Char_Panel.cs.meta b/SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/Ui_Char_Panel.cs.meta
new file mode 100644
index 0000000..5bf767c
--- /dev/null
+++ b/SurvivalTest/Assets/ACS-17/Demo_Table_Animations/Scripts/Ui_Char_Panel.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 86ff6b748a053c84b85dec12224f4695
+timeCreated: 1481781414
+licenseType: Store
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: