Фича с "покручивающимися фишками" на поле
This commit is contained in:
parent
0731921ee7
commit
b2ee79a408
@ -29932,6 +29932,7 @@ GameObject:
|
||||
- component: {fileID: 1768372453}
|
||||
- component: {fileID: 1768372455}
|
||||
- component: {fileID: 1768372454}
|
||||
- component: {fileID: 1768372456}
|
||||
m_Layer: 0
|
||||
m_Name: Board
|
||||
m_TagString: Untagged
|
||||
@ -30050,6 +30051,20 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Board
|
||||
pointer: {fileID: 1615046714}
|
||||
--- !u!114 &1768372456
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1768372451}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 064bff9626118c04bb5673ce2b97736d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::ChipsRotator
|
||||
angle: 15
|
||||
speed: 4
|
||||
--- !u!1 &1769485032
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -55,6 +55,7 @@ public class ChipPool : MonoBehaviour
|
||||
throw new InvalidOperationException("Пул фишек не инициализирован");
|
||||
|
||||
chip.gameObject.SetActive(false);
|
||||
chip.transform.rotation = Quaternion.identity;
|
||||
chip.transform.SetParent(transform);
|
||||
_availableChips.Enqueue(chip);
|
||||
}
|
||||
|
||||
25
Assets/Scripts/Gameplay/ChipsRotator.cs
Normal file
25
Assets/Scripts/Gameplay/ChipsRotator.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
[RequireComponent(typeof(Board))]
|
||||
public class ChipsRotator : MonoBehaviour
|
||||
{
|
||||
[SerializeField] float angle = 15;
|
||||
[SerializeField] float speed = 4;
|
||||
|
||||
private Board board;
|
||||
|
||||
private void Start() => board = GetComponent<Board>();
|
||||
|
||||
private void Update()
|
||||
{
|
||||
float y = angle * Unity.Mathematics.math.sin(speed * Time.time);
|
||||
|
||||
foreach (Chip chip in board.Grid)
|
||||
{
|
||||
if (chip == null) continue;
|
||||
|
||||
chip.transform.localRotation = Quaternion.Euler(0, y, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Gameplay/ChipsRotator.cs.meta
Normal file
2
Assets/Scripts/Gameplay/ChipsRotator.cs.meta
Normal file
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 064bff9626118c04bb5673ce2b97736d
|
||||
Loading…
x
Reference in New Issue
Block a user