Merge branch 'master' into sideObjects

This commit is contained in:
playmaker1210
2023-05-16 14:28:53 +02:00
committed by GitHub
5 changed files with 65 additions and 31 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: