throw minions
This commit is contained in:
parent
f1d104d7cd
commit
62bdfa65ab
@ -11,6 +11,7 @@ GameObject:
|
||||
- component: {fileID: 1214567908930553594}
|
||||
- component: {fileID: 1214567908930553592}
|
||||
- component: {fileID: 3126145803593047825}
|
||||
- component: {fileID: 1967503440015794769}
|
||||
- component: {fileID: 1214567908930553595}
|
||||
- component: {fileID: 1214567908930553477}
|
||||
- component: {fileID: 945832017}
|
||||
@ -32,7 +33,8 @@ Transform:
|
||||
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_Children:
|
||||
- {fileID: 5561158611004983940}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@ -61,7 +63,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 3d475633c5bc498fac5a9e5ead64da55, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
<Health>k__BackingField: 10
|
||||
<Health>k__BackingField: 100
|
||||
movementSpeed: 0
|
||||
rotSpeed: 0
|
||||
fov: 0
|
||||
@ -70,6 +72,20 @@ MonoBehaviour:
|
||||
attackCooldown: 0
|
||||
target: {fileID: 0}
|
||||
healthBar: {fileID: 0}
|
||||
--- !u!114 &1967503440015794769
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1214567908930553593}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 56c3e06ea5db48a40a7f55e72291cb0d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
minionPrefabs: []
|
||||
aimArrow: {fileID: 5124059627794595469}
|
||||
--- !u!212 &1214567908930553595
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -160,6 +176,18 @@ MonoBehaviour:
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
- m_Target: {fileID: 1967503440015794769}
|
||||
m_TargetAssemblyTypeName: MinionThrower, Assembly-CSharp
|
||||
m_MethodName: AimThrow
|
||||
m_Mode: 0
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
m_ActionId: 1071c237-0382-46b6-9750-c39a686354f8
|
||||
m_ActionName: Player/Move[/XInputControllerWindows/leftStick,/Keyboard/w,/Keyboard/upArrow,/Keyboard/s,/Keyboard/downArrow,/Keyboard/a,/Keyboard/leftArrow,/Keyboard/d,/Keyboard/rightArrow]
|
||||
- m_PersistentCalls:
|
||||
@ -223,9 +251,37 @@ MonoBehaviour:
|
||||
m_ActionId: 6e7e8be9-9198-4490-bb0c-a25fa63601b6
|
||||
m_ActionName: UI/TrackedDeviceOrientation
|
||||
- m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 0}
|
||||
m_TargetAssemblyTypeName: MinionBar, Assembly-CSharp
|
||||
m_MethodName: ChangeSelectedIcon
|
||||
m_Mode: 0
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
m_ActionId: d0405457-c534-4103-a0b6-cf113432b467
|
||||
m_ActionName: Player/SwitchMinion[/Keyboard/q,/Keyboard/e,/XInputControllerWindows/leftShoulder,/XInputControllerWindows/rightShoulder]
|
||||
- m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1967503440015794769}
|
||||
m_TargetAssemblyTypeName: MinionThrower, Assembly-CSharp
|
||||
m_MethodName: ToggleThrowMode
|
||||
m_Mode: 0
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
m_ActionId: 6f870ff4-cc58-4173-855c-37192c5b63f5
|
||||
m_ActionName: Player/Throw[/Keyboard/r,/XInputControllerWindows/buttonNorth]
|
||||
m_NeverAutoSwitchControlSchemes: 0
|
||||
m_DefaultControlScheme:
|
||||
m_DefaultActionMap: Player
|
||||
@ -268,3 +324,116 @@ CircleCollider2D:
|
||||
m_Offset: {x: 0, y: 0}
|
||||
serializedVersion: 2
|
||||
m_Radius: 0.5
|
||||
--- !u!1 &5124059627794595469
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5561158611004983940}
|
||||
m_Layer: 0
|
||||
m_Name: Aim Arrow
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5561158611004983940
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5124059627794595469}
|
||||
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:
|
||||
- {fileID: 8093247208668955472}
|
||||
m_Father: {fileID: 1214567908930553594}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &8736979949924850885
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8093247208668955472}
|
||||
- component: {fileID: 6844473735558022839}
|
||||
m_Layer: 0
|
||||
m_Name: Arrow
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &8093247208668955472
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8736979949924850885}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 1.75, y: 0, z: 0}
|
||||
m_LocalScale: {x: 2, y: 0.1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 5561158611004983940}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &6844473735558022839
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8736979949924850885}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f59a47f07e3cae9489f9e6fc735d8710
|
||||
guid: c00861c3185f81f4984c70107e571f82
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class EnemySpawner : MonoBehaviour {
|
||||
|
||||
public float delay;
|
||||
public GameObject[] enemyPrefabs;
|
||||
public Transform[] spawnPoints;
|
||||
|
||||
void Start() {
|
||||
StartCoroutine(SpawnRoutine());
|
||||
}
|
||||
|
||||
IEnumerator SpawnRoutine() {
|
||||
while(true) {
|
||||
|
||||
yield return new WaitForSeconds(delay);
|
||||
|
||||
int enemyIndex = Random.Range(0, enemyPrefabs.Length);
|
||||
int positionIndex = Random.Range(0, spawnPoints.Length);
|
||||
|
||||
GameObject newEnemy = Instantiate(enemyPrefabs[enemyIndex], spawnPoints[positionIndex].position, Quaternion.identity, transform);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 980fcc6b06b84694080efd936a8fbcf0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -5,6 +5,7 @@ using UnityEngine.InputSystem;
|
||||
|
||||
public class MinionThrower : MonoBehaviour {
|
||||
|
||||
public GameObject[] minionPrefabs;
|
||||
public GameObject aimArrow;
|
||||
|
||||
bool isInThrowMode;
|
||||
@ -13,20 +14,27 @@ public class MinionThrower : MonoBehaviour {
|
||||
|
||||
void Awake() {
|
||||
minionBar = FindObjectOfType<MinionBar>();
|
||||
aimArrow.SetActive(false);
|
||||
}
|
||||
|
||||
void Start() {
|
||||
foreach (GameObject minion in minionPrefabs) {
|
||||
minionBar.AddMinionType(minion);
|
||||
}
|
||||
}
|
||||
|
||||
public void ToggleThrowMode(InputAction.CallbackContext context) {
|
||||
print("a " + context.phase.ToString());
|
||||
if (context.performed) {
|
||||
isInThrowMode = true;
|
||||
aimArrow.SetActive(true);
|
||||
} else if (context.canceled) {
|
||||
PerformThrow();
|
||||
isInThrowMode = false;
|
||||
aimArrow.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void AimThrow(InputAction.CallbackContext context) {
|
||||
print("b " + context.ReadValue<Vector2>().ToString());
|
||||
throwDirection = context.ReadValue<Vector2>().normalized;
|
||||
aimArrow.transform.rotation = Quaternion.FromToRotation(transform.right, throwDirection);
|
||||
}
|
||||
|
||||
@ -5,24 +5,29 @@ using UnityEngine.InputSystem;
|
||||
|
||||
public class MinionBar : MonoBehaviour {
|
||||
|
||||
public GameObject[] minionTypes;
|
||||
List<GameObject> minionTypes;
|
||||
public GameObject minionIconPrefab;
|
||||
|
||||
MinionIcon[] minionIcons;
|
||||
List<MinionIcon> minionIcons;
|
||||
int currentIndex;
|
||||
|
||||
public void Start() {
|
||||
minionIcons = new MinionIcon[minionTypes.Length];
|
||||
for (int i=0; i<minionTypes.Length; ++i) {
|
||||
GameObject newIconObj = Instantiate(minionIconPrefab, transform);
|
||||
minionIcons[i] = newIconObj.GetComponent<MinionIcon>();
|
||||
// minionIcons[i].icon = minionTypes.icon; // TODO
|
||||
minionIcons[i].indexInMinionList = i;
|
||||
minionIcons[i].UnSelect();
|
||||
}
|
||||
minionIcons[currentIndex].Select();
|
||||
void Awake() {
|
||||
minionTypes = new List<GameObject>();
|
||||
minionIcons = new List<MinionIcon>();
|
||||
}
|
||||
|
||||
// public void Start() {
|
||||
// minionIcons = new List<MinionIcon>();
|
||||
// for (int i=0; i<minionTypes.Count; ++i) {
|
||||
// GameObject newIconObj = Instantiate(minionIconPrefab, transform);
|
||||
// minionIcons.Add(newIconObj.GetComponent<MinionIcon>());
|
||||
// // minionIcons[i].icon = minionTypes.icon; // TODO
|
||||
// minionIcons[i].indexInMinionList = i;
|
||||
// minionIcons[i].UnSelect();
|
||||
// }
|
||||
// minionIcons[currentIndex].Select();
|
||||
// }
|
||||
|
||||
public void ChangeSelectedIcon(InputAction.CallbackContext context) {
|
||||
|
||||
float floatDelta = context.ReadValue<float>();
|
||||
@ -36,16 +41,29 @@ public class MinionBar : MonoBehaviour {
|
||||
minionIcons[currentIndex].UnSelect();
|
||||
|
||||
currentIndex += delta;
|
||||
if(currentIndex >= minionIcons.Length) {
|
||||
if(currentIndex >= minionIcons.Count) {
|
||||
currentIndex = 0;
|
||||
} else if(currentIndex < 0) {
|
||||
currentIndex = minionIcons.Length - 1;
|
||||
currentIndex = minionIcons.Count - 1;
|
||||
}
|
||||
|
||||
minionIcons[currentIndex].Select();
|
||||
// print("new selected minion type : " + currentIndex.ToString());
|
||||
}
|
||||
|
||||
public void AddMinionType(GameObject newMinionPrefab) {
|
||||
minionTypes.Add(newMinionPrefab);
|
||||
MinionIcon newIcon = Instantiate(minionIconPrefab, transform).GetComponent<MinionIcon>();
|
||||
minionIcons.Add(newIcon);
|
||||
// minionIcons[i].icon = minionTypes.icon; // TODO
|
||||
newIcon.indexInMinionList = minionIcons.Count;
|
||||
if(currentIndex == minionIcons.Count - 1) {
|
||||
newIcon.Select();
|
||||
} else {
|
||||
newIcon.UnSelect();
|
||||
}
|
||||
}
|
||||
|
||||
public GameObject GetCurrentMinion() {
|
||||
return minionTypes[currentIndex];
|
||||
}
|
||||
|
||||
@ -41,15 +41,6 @@
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Aim",
|
||||
"type": "Value",
|
||||
"id": "09f4053a-a3bc-44c9-829a-ec0efcb4551d",
|
||||
"expectedControlType": "Vector2",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": true
|
||||
},
|
||||
{
|
||||
"name": "Throw",
|
||||
"type": "Button",
|
||||
@ -324,72 +315,6 @@
|
||||
"action": "Throw",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "9feebf49-c2e0-4cf1-9a0c-210f8d284c99",
|
||||
"path": "<Gamepad>/rightStick",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Aim",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "Directionnal arrows",
|
||||
"id": "3746bd1a-6768-44b7-be2e-d28e87b34679",
|
||||
"path": "2DVector",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Aim",
|
||||
"isComposite": true,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "up",
|
||||
"id": "3dc03336-9818-4b34-adcd-7b4e29584953",
|
||||
"path": "<Keyboard>/upArrow",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Aim",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "down",
|
||||
"id": "a6cbc7d7-7102-4fa4-a950-76c9a53eed92",
|
||||
"path": "<Keyboard>/downArrow",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Aim",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "left",
|
||||
"id": "5dc64a8b-901d-4277-9c52-2dcc67ff276b",
|
||||
"path": "<Keyboard>/leftArrow",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Aim",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "right",
|
||||
"id": "124bbe5b-42cc-49cc-afc4-b0d4c28e69ef",
|
||||
"path": "<Keyboard>/rightArrow",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Aim",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user