Commit 72635724 authored by Marcel Kuehn's avatar Marcel Kuehn
Browse files

ChallangerController geschrieben und prefab dafür in resources, welches über...

ChallangerController geschrieben und prefab dafür in resources, welches über inLevelCotroller automatisch geladen wird wenn varibale in GameManager true ist.

Die Position des Challanger ist scheinbar noch nicht die des players
parent 46c95adc
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_SourcePrefab: {fileID: 0}
m_RootGameObject: {fileID: 1473882291736946}
m_IsPrefabAsset: 1
--- !u!1 &1473882291736946
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6
m_Component:
- component: {fileID: 4143147008631634}
- component: {fileID: 114764353408195872}
m_Layer: 0
m_Name: ChallengerModus
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4143147008631634
Transform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1473882291736946}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 3.6737773, y: 1.7891176, z: -0.048828125}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &114764353408195872
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1473882291736946}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7e98e65d5258913459ccbd3759232399, type: 3}
m_Name:
m_EditorClassIdentifier:
waitTime: 0
fileFormatVersion: 2
guid: fdbf151592f5d2b4dabd99b6e4dee1ab
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ChallagerController : MonoBehaviour
{
private PlayerActor pa;
public float waitTime;
private Queue<Vector3> oldPosition= new Queue<Vector3>();
// Use this for initialization
void Start () {
pa= GetComponent<PlayerActor>();
waitTime = 2.0f;
}
// Update is called once per frame
void FixedUpdate () {
if (waitTime <= 0f)
{
oldPosition.Enqueue(pa.transform.position);
transform.position = oldPosition.Dequeue();
}
else
{
waitTime -= Time.deltaTime;
oldPosition.Enqueue(pa.transform.position);
}
}
}
fileFormatVersion: 2
guid: 7e98e65d5258913459ccbd3759232399
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -22,6 +22,7 @@ public class GameManager : SingletonBehaviour<GameManager>
private GameObject PauseMenu =null ; //Damit wird das PauseMenu gespeichert
public bool inLevel { get; set; }
public bool challenger { get; set; }
......@@ -33,6 +34,7 @@ public class GameManager : SingletonBehaviour<GameManager>
private void Awake()
{
challenger = false;
inLevel = false;
HighestLevel = 1;
......@@ -150,4 +152,20 @@ public class GameManager : SingletonBehaviour<GameManager>
ls.Safe(currentLevel, highestLevel);
}
public void SetChallengerOn()
{
challenger = true;
}
public void SetChallangerOff()
{
challenger = false;
}
}
\ No newline at end of file
......@@ -12,6 +12,15 @@ public class InLevelController : MonoBehaviour {
gm.inLevel = true;
}
private void Start()
{
if (gm.challenger)
{
GameObject go = Instantiate(Resources.Load<GameObject>("ChallengerModus"));
}
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
......@@ -31,4 +40,8 @@ public class InLevelController : MonoBehaviour {
{
gm.LevelFinished();
}
}
......@@ -376,7 +376,7 @@ public class PlayerActor : MonoBehaviour {
UpdateOrientation();
}
private void Die()
public void Die()
{
transform.position = startingPosition;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment