code/vladimir rezyapkin/butterfly test - #96
Open
Dant777 wants to merge 1 commit into
Open
Conversation
MSnihurska
reviewed
Oct 28, 2020
MSnihurska
left a comment
Contributor
There was a problem hiding this comment.
Отличная работа! За исключением пары ошибок в оромлении, сам код хороший.
Советую обратить внимание на InteractableObject и Rabbit - у них нет отдельных контроллеров. Они обрабатываются общим EnemyController, за счет иерархии классов и наследования от EnemyModel и EnemyData.
Comment on lines
+1
to
+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 ); | ||
| } | ||
| } |
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using Assets.Scripts.EntityScripts.Example.Butterfly; |
Contributor
There was a problem hiding this comment.
Тут и дальше: для примера хорошее решение, но для сущностей в проекте лучше писать в общем пространстве имен BeastHunter
Comment on lines
+22
to
+26
| _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); | ||
|
|
Contributor
There was a problem hiding this comment.
Привести в соответствие с Code Convention (убрать магические цифры и лишние строки)
Contributor
Author
|
Спасибо! В Следующий раз будет лучше)
ср, 28 окт. 2020 г. в 16:38, RinaSatsu <notifications@github.com>:
… ***@***.**** commented on this pull request.
Отличная работа! За исключением пары ошибок в оромлении, сам код хороший.
Советую обратить внимание на InteractableObject и Rabbit - у них нет
отдельных контроллеров. Они обрабатываются общим EnemyController, за счет
иерархии классов и наследования от EnemyModel и EnemyData.
------------------------------
In Assets/Resources/Data/Move.cs
<#96 (comment)>:
> +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 );
+ }
+}
Забыли удалить :)
------------------------------
In Assets/Scripts/Contexts/GameContext.cs
<#96 (comment)>:
> @@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Assets.Scripts.EntityScripts.Example.Butterfly;
Тут и дальше: для примера хорошее решение, но для сущностей в проекте
лучше писать в общем пространстве имен BeastHunter
------------------------------
In Assets/Scripts/EntityScripts/Example/Butterfly/ButterflyData.cs
<#96 (comment)>:
> + _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);
+
Привести в соответствие с Code Convention (убрать магические цифры и
лишние строки)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#96 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALI4CFKJM2WPGBXQ4TT4W33SNANF7ANCNFSM4TB6UVOA>
.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
butterfly test