-
Notifications
You must be signed in to change notification settings - Fork 55
code/vladimir rezyapkin/butterfly test #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: example/rabbit-ai
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| %YAML 1.1 | ||
| %TAG !u! tag:unity3d.com,2011: | ||
| --- !u!114 &11400000 | ||
| MonoBehaviour: | ||
| m_ObjectHideFlags: 0 | ||
| m_CorrespondingSourceObject: {fileID: 0} | ||
| m_PrefabInstance: {fileID: 0} | ||
| m_PrefabAsset: {fileID: 0} | ||
| m_GameObject: {fileID: 0} | ||
| m_Enabled: 1 | ||
| m_EditorHideFlags: 0 | ||
| m_Script: {fileID: 11500000, guid: bc91d10bd25a30f45b8dc86a5e109045, type: 3} | ||
| m_Name: ButterflyData | ||
| m_EditorClassIdentifier: | ||
| ButterflyStruct: | ||
| MoveSpeed: 1 | ||
| FlightRadius: 2 | ||
| Prefab: {fileID: 8239778560251154675, guid: 43dea1108edb3fd4eb24e34f86cfaaa1, | ||
| type: 3} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| using System.Collections; | ||
| using System.Collections.Generic; | ||
| using UnityEngine; | ||
|
|
||
| public class Move : MonoBehaviour | ||
| { | ||
| public Transform Center; | ||
| public float angle = 0; | ||
|
|
||
| public float speed = 1; | ||
| public float radius = 1f; | ||
|
|
||
| // Start is called before the first frame update | ||
| void Start() | ||
| { | ||
|
|
||
| } | ||
|
|
||
| // Update is called once per frame | ||
| void Update() | ||
| { | ||
| //transform.position = Vector3.MoveTowards(transform.position, target.position, Time.deltaTime); | ||
| angle += Time.deltaTime; | ||
| var x = Mathf.Cos(angle * speed) * radius; | ||
| var z = Mathf.Sin(angle * speed) * radius; | ||
| transform.position = new Vector3(x, Center.position.y, z) + Center.position; | ||
|
|
||
| //transform.RotateAround(Center.position, Vector3.up, 10 * Time.deltaTime ); | ||
| } | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using Assets.Scripts.EntityScripts.Example.Butterfly; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Тут и дальше: для примера хорошее решение, но для сущностей в проекте лучше писать в общем пространстве имен BeastHunter |
||
| using UnityEngine; | ||
|
|
||
| namespace BeastHunter | ||
|
|
@@ -10,6 +11,7 @@ public sealed class GameContext : Contexts | |
| #region Fields | ||
|
|
||
| public SphereModel SphereModel; | ||
| public ButterflyModel ButterflyModel; | ||
| public CharacterModel CharacterModel; | ||
| public InputModel InputModel; | ||
|
|
||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| %YAML 1.1 | ||
| %TAG !u! tag:unity3d.com,2011: | ||
| --- !u!1 &8239778560251154675 | ||
| GameObject: | ||
| m_ObjectHideFlags: 0 | ||
| m_CorrespondingSourceObject: {fileID: 0} | ||
| m_PrefabInstance: {fileID: 0} | ||
| m_PrefabAsset: {fileID: 0} | ||
| serializedVersion: 6 | ||
| m_Component: | ||
| - component: {fileID: 8969811764616920469} | ||
| - component: {fileID: 2480563093512411019} | ||
| - component: {fileID: 755557080889516838} | ||
| - component: {fileID: 3607247200987312626} | ||
| m_Layer: 0 | ||
| m_Name: Butterfly | ||
| m_TagString: Untagged | ||
| m_Icon: {fileID: 0} | ||
| m_NavMeshLayer: 0 | ||
| m_StaticEditorFlags: 0 | ||
| m_IsActive: 1 | ||
| --- !u!4 &8969811764616920469 | ||
| Transform: | ||
| m_ObjectHideFlags: 0 | ||
| m_CorrespondingSourceObject: {fileID: 0} | ||
| m_PrefabInstance: {fileID: 0} | ||
| m_PrefabAsset: {fileID: 0} | ||
| m_GameObject: {fileID: 8239778560251154675} | ||
| m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||
| m_LocalPosition: {x: 0.7385025, y: 8.641604, z: 5.1330833} | ||
| m_LocalScale: {x: 1, y: 1, z: 1} | ||
| m_Children: [] | ||
| m_Father: {fileID: 0} | ||
| m_RootOrder: 0 | ||
| m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||
| --- !u!33 &2480563093512411019 | ||
| MeshFilter: | ||
| m_ObjectHideFlags: 0 | ||
| m_CorrespondingSourceObject: {fileID: 0} | ||
| m_PrefabInstance: {fileID: 0} | ||
| m_PrefabAsset: {fileID: 0} | ||
| m_GameObject: {fileID: 8239778560251154675} | ||
| m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} | ||
| --- !u!23 &755557080889516838 | ||
| MeshRenderer: | ||
| m_ObjectHideFlags: 0 | ||
| m_CorrespondingSourceObject: {fileID: 0} | ||
| m_PrefabInstance: {fileID: 0} | ||
| m_PrefabAsset: {fileID: 0} | ||
| m_GameObject: {fileID: 8239778560251154675} | ||
| m_Enabled: 1 | ||
| m_CastShadows: 1 | ||
| m_ReceiveShadows: 1 | ||
| m_DynamicOccludee: 1 | ||
| m_MotionVectors: 1 | ||
| m_LightProbeUsage: 1 | ||
| m_ReflectionProbeUsage: 1 | ||
| m_RenderingLayerMask: 1 | ||
| m_RendererPriority: 0 | ||
| m_Materials: | ||
| - {fileID: 2100000, guid: 0bd57d436f61a29468114c16b56af2e5, type: 2} | ||
| m_StaticBatchInfo: | ||
| firstSubMesh: 0 | ||
| subMeshCount: 0 | ||
| m_StaticBatchRoot: {fileID: 0} | ||
| m_ProbeAnchor: {fileID: 0} | ||
| m_LightProbeVolumeOverride: {fileID: 0} | ||
| m_ScaleInLightmap: 1 | ||
| m_PreserveUVs: 0 | ||
| m_IgnoreNormalsForChartDetection: 0 | ||
| m_ImportantGI: 0 | ||
| m_StitchLightmapSeams: 1 | ||
| m_SelectedEditorRenderState: 3 | ||
| m_MinimumChartSize: 4 | ||
| m_AutoUVMaxDistance: 0.5 | ||
| m_AutoUVMaxAngle: 89 | ||
| m_LightmapParameters: {fileID: 0} | ||
| m_SortingLayerID: 0 | ||
| m_SortingLayer: 0 | ||
| m_SortingOrder: 0 | ||
| --- !u!135 &3607247200987312626 | ||
| SphereCollider: | ||
| m_ObjectHideFlags: 0 | ||
| m_CorrespondingSourceObject: {fileID: 0} | ||
| m_PrefabInstance: {fileID: 0} | ||
| m_PrefabAsset: {fileID: 0} | ||
| m_GameObject: {fileID: 8239778560251154675} | ||
| m_Material: {fileID: 0} | ||
| m_IsTrigger: 0 | ||
| m_Enabled: 1 | ||
| serializedVersion: 2 | ||
| m_Radius: 0.5 | ||
| m_Center: {x: 0, y: 0, z: 0} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| using System; | ||
| using BeastHunter; | ||
| using UnityEngine; | ||
|
|
||
| namespace Assets.Scripts.EntityScripts.Example.Butterfly | ||
| { | ||
| public sealed class ButterflyController : IAwake, IUpdate | ||
| { | ||
| #region Fields | ||
|
|
||
| private readonly GameContext _context; | ||
|
|
||
| #endregion | ||
|
|
||
| #region ClassLifeCycle | ||
|
|
||
| public ButterflyController(GameContext context) | ||
| { | ||
| _context = context; | ||
| } | ||
|
|
||
| #endregion | ||
|
|
||
| #region IUpdate | ||
|
|
||
| public void Updating() | ||
| { | ||
| _context.ButterflyModel.Initilize(); | ||
| } | ||
|
|
||
| #endregion | ||
|
|
||
|
|
||
| #region IAwake | ||
|
|
||
| public void OnAwake() | ||
| { | ||
|
|
||
| } | ||
|
|
||
| #endregion | ||
| } | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| using UnityEngine; | ||
|
|
||
| namespace Assets.Scripts.EntityScripts.Example.Butterfly | ||
| { | ||
| [CreateAssetMenu(fileName = "NewData", menuName = "CreateData/Butterfly", order = 4)] | ||
| public sealed class ButterflyData : ScriptableObject | ||
| { | ||
| #region Fields | ||
|
|
||
| public ButterflyStruct ButterflyStruct; | ||
| private float _angle = 0; | ||
|
|
||
|
|
||
|
|
||
| #endregion | ||
|
|
||
| #region Metods | ||
|
|
||
| public void Move(Transform transform, float speed, float radius) | ||
| { | ||
|
|
||
| _angle += Time.deltaTime; | ||
| var x = Mathf.Cos(_angle * speed) * radius; | ||
| var z = Mathf.Sin(_angle * speed) * radius; | ||
| transform.position = new Vector3(x, 1f, z) + new Vector3(-3.58f, 1f, 15.43f); | ||
|
|
||
|
Comment on lines
+22
to
+26
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Привести в соответствие с Code Convention (убрать магические цифры и лишние строки) |
||
| } | ||
|
|
||
|
|
||
|
|
||
| #endregion | ||
|
|
||
| } | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Забыли удалить :)