asd
This commit is contained in:
bance
2023-04-12 17:26:17 +02:00
parent 2f4caf9a07
commit 604088eaa4
3 changed files with 218 additions and 4 deletions

46
Assets/Scripts/Targyak.cs Normal file
View File

@@ -0,0 +1,46 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Targyak : MonoBehaviour
{
int fsz_elerheto = 1; //ennyi darab fenséges szárny tárgya van a játékosnak
public GameObject bobby; //a karakter akit mozgatunk
public Transform targetFent; //a fenti pont ahova felrepül
public Transform targetLent; //a lenti pont ahol alapból fut
public float speed; //a sebesség amivel felrepül
private void FensegesSzarnyak()
{
if (fsz_elerheto > 0) //ha van legalább 1 ilyen tárgya
{
Vector3 a = transform.position;
Vector3 b = targetFent.position;
Vector3 c = targetLent.position;
bobby.transform.position = Vector3.MoveTowards(a, b, speed); //itt felrepül
TimerSzarnyak(); //eddig repülsz
bobby.transform.position = Vector3.MoveTowards(a, c, speed); //itt pedig visszaérkezik a földre
}
}
IEnumerator TimerSzarnyak()
{
yield return new WaitForSecondsRealtime(5); //vár 5 másodpercet
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: af7cebaa4cf844a54a550572d1f9be69
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: