aha
asd
This commit is contained in:
46
Assets/Scripts/Targyak.cs
Normal file
46
Assets/Scripts/Targyak.cs
Normal 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
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Targyak.cs.meta
Normal file
11
Assets/Scripts/Targyak.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af7cebaa4cf844a54a550572d1f9be69
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user