Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Assets/Resources/Data/ButterflyData.asset
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}
8 changes: 8 additions & 0 deletions Assets/Resources/Data/ButterflyData.asset.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions Assets/Resources/Data/Data.asset
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
_sphereDataPath: SphereData
_characterDataPath: CharacterData
_startDialogueDataPath: StartDialogueData
_dialogueSystemDataPath: DialogueSystemData
_giantMudCrabDataPath: GiantMudCrabData
_rabbitDataPath: RabbitData
_butterflyDataPath: ButterflyData
_feastPath: Weapons/FeastWeapon
_jacketPath: Clothes/Jacket
_cameraDataPath: CameraData
_rabbitDataPath: RabbitData
_questIndicatorDataPath: QuestIndicatorData
_questJournalDataPath: QuestJournalData

30 changes: 30 additions & 0 deletions Assets/Resources/Data/Move.cs
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 );
}
}
Comment on lines +1 to +30

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Забыли удалить :)

11 changes: 11 additions & 0 deletions Assets/Resources/Data/Move.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Assets/Scripts/Contexts/GameContext.cs
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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут и дальше: для примера хорошее решение, но для сущностей в проекте лучше писать в общем пространстве имен BeastHunter

using UnityEngine;

namespace BeastHunter
Expand All @@ -10,6 +11,7 @@ public sealed class GameContext : Contexts
#region Fields

public SphereModel SphereModel;
public ButterflyModel ButterflyModel;
public CharacterModel CharacterModel;
public InputModel InputModel;

Expand Down
11 changes: 8 additions & 3 deletions Assets/Scripts/Controllers/BaseControllers/MainControllers.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace BeastHunter
using Assets.Scripts.EntityScripts.Example.Butterfly;

namespace BeastHunter
{
public sealed class MainControllers : ControllersStart
{
Expand All @@ -21,13 +23,16 @@ private void AddInitializeControllers(GameContext context)
//Add<T>(context) where T : EnemyInitializeController

//Add(new SphereInitilizeController(context));
//Add(new IOInitializeController(context));
// Add(new IOInitializeController(context));
Add(new CharacterInitilizeController(context));
Add(new RabbitInitializeController(context));
Add(new RabbitInitializeController(context));
Add(new ButterflyInitilizeController(context));
}

private void AddControllers(GameContext context)
{
//Add(new SphereController(context));
Add(new ButterflyController(context));
Add(new EnemyController(context));
Add(new TargetController(context));
Add(new InputController(context));
Expand Down
17 changes: 15 additions & 2 deletions Assets/Scripts/Data/Data.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.IO;
using Assets.Scripts.EntityScripts.Example.Butterfly;
using UnityEngine;


Expand All @@ -10,14 +11,16 @@ public sealed class Data : ScriptableObject {
[SerializeField] private string _sphereDataPath;
[SerializeField] private string _characterDataPath;
[SerializeField] private string _rabbitDataPath;
[SerializeField] private string _butterflyDataPath;
[SerializeField] private string _feastPath;
[SerializeField] private string _jacketPath;
[SerializeField] private string _cameraDataPath;

private static Data _instance;
private static SphereData _sphereData;
private static CharacterData _characterData;
private static RabbitData _rabbitData;
private static ButterflyData _butterflyData;
private static WeaponItem _feast;
private static ClothItem _jacket;
private static CameraData _cameraData;
Expand Down Expand Up @@ -65,7 +68,17 @@ public static RabbitData RabbitData
return _rabbitData;
}
}

public static ButterflyData ButterflyData
{
get
{
if (_butterflyData == null)
{
_butterflyData = Load<ButterflyData>("Data/" + Instance._butterflyDataPath);
}
return _butterflyData;
}
}
public static WeaponItem Feast {
get {
if (_feast == null) {
Expand Down
8 changes: 8 additions & 0 deletions Assets/Scripts/EntityScripts/Example/Butterfly.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

93 changes: 93 additions & 0 deletions Assets/Scripts/EntityScripts/Example/Butterfly/Butterfly.prefab
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.

34 changes: 34 additions & 0 deletions Assets/Scripts/EntityScripts/Example/Butterfly/ButterflyData.cs
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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.

Loading