Фича с "покручивающимися фишками" на поле

This commit is contained in:
Сергей Бондарь 2026-08-05 09:35:20 +03:00
parent 0731921ee7
commit b2ee79a408
4 changed files with 43 additions and 0 deletions

View File

@ -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

View File

@ -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);
}

View 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);
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 064bff9626118c04bb5673ce2b97736d