Commit 714992fa authored by HavocDeadeye's avatar HavocDeadeye
Browse files

Merge remote-tracking branch 'origin/master'

parents d9dfbee7 e4bc32db
......@@ -12,5 +12,5 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 1cf2129e099ba6649b9b83699072046b, type: 3}
m_Name: WindTile
m_EditorClassIdentifier:
sprite: {fileID: 21300000, guid: 3b82b26f0b16f8e48ae67381e4fbcfb2, type: 3}
direction: {x: 1, y: 0}
m_Name: WindTile
m_EditorClassIdentifier:
This diff is collapsed.
......@@ -26,6 +26,7 @@ public class GroupController : MonoBehaviour, IKillTarget
void Start()
{
gameManager = FindObjectOfType<GameManager>();
gameManager.currentLemmings = 10;
AllLemmingAnimator = GetComponentsInChildren<Animator>();
AllLemmingSpriteRenderer = GetComponentsInChildren<SpriteRenderer>();
......@@ -47,6 +48,16 @@ public class GroupController : MonoBehaviour, IKillTarget
}
ActiveLemmingIndex = 0;
SetActiveLemming(ActiveLemmingIndex);
while(gameManager.currentLemmings > gameManager.maxLevelLemming)
{
RemoveLemmingFromGroup();
}
}
public void SetActiveLemming(float index)
{
ActiveLemming = PlayableLemmings[ActiveLemmingIndex];
ActiveLemmingMovement = ActiveLemming.GetComponent<LemmingMovement>();
ActiveLemmingGroupPosition = ActiveLemming.transform.localPosition;
......@@ -56,6 +67,7 @@ public class GroupController : MonoBehaviour, IKillTarget
public void RemoveLemmingFromGroup()
{
gameManager.currentLemmings--;
if (ActiveLemmingIndex + 1 <= PlayableLemmings.Length)
{
Destroy(ActiveLemming);
......@@ -75,24 +87,16 @@ public class GroupController : MonoBehaviour, IKillTarget
float zCoordinate = ActiveLemming.transform.position.z;
bool activeHitGroup = false;
foreach(var collider in GetComponents<Collider2D>())
foreach (var collider in GetComponents<BoxCollider2D>())
{
if (collider.isTrigger)
{
activeHitGroup = ActiveLemming.GetComponent<Collider2D>().IsTouching(collider);
}
}
if (pcButton)
{
activeHitGroup = true;
activeHitGroup = collider.bounds.Contains(ActiveLemming.transform.position);
}
if (zCoordinate == 0 && activeHitGroup)
{
LemmingEnterGroup();
}
else
else if(zCoordinate!=0)
{
LemmingExitGroup(zCoordinate);
}
......@@ -140,12 +144,18 @@ public class GroupController : MonoBehaviour, IKillTarget
groupMovement.MoveHorizontal(direction);
foreach (var animator in AllLemmingAnimator)
{
animator.SetFloat("Speed", Mathf.Abs(direction));
if (animator != null)
{
animator.SetFloat("Speed", Mathf.Abs(direction));
}
}
foreach (var sprite in AllLemmingSpriteRenderer)
{
sprite.flipX = isDirectionPositiv;
if (sprite != null)
{
sprite.flipX = isDirectionPositiv;
}
}
}
else if (!blockedInput)
......@@ -167,9 +177,8 @@ public class GroupController : MonoBehaviour, IKillTarget
public void DoubleTab(Touch touch)
{
Ray ray = Camera.main.ScreenPointToRay(touch.position);
RaycastHit vHit;
if (Physics.Raycast(ray.origin, ray.direction, out vHit))
RaycastHit2D vHit = Physics2D.Raycast(ray.origin, ray.direction);
if (vHit.collider != null)
{
if (vHit.transform.tag == "Group")
{
......
......@@ -13,11 +13,12 @@ public class GameManager : MonoBehaviour
public int level = 1;
public int leben = 3;
public int lemminge = 10;
public int currentLemmings = 10;
public bool existSingleLemming = false;
public Dictionary<string, bool> UnlockedAbilities { get; private set; }
public bool SuperJumpActivated { get; set; }
public int maxLevelLemming { get; set; }
public Button actionButton;
private InteractebaleSwitch interactebaleSwitch;
......@@ -40,6 +41,7 @@ public class GameManager : MonoBehaviour
private void Start()
{
actionButton.enabled = false;
maxLevelLemming = 10;
}
public void EnableIngameUI(bool enable)
......@@ -104,13 +106,13 @@ public class GameManager : MonoBehaviour
{
level = 1;
leben = 3;
lemminge = 10;
currentLemmings = 10;
}
public void GameOver()
{
SceneManager.LoadScene("Level " + level, LoadSceneMode.Single);
leben = 3;
lemminge = 10;
currentLemmings = 10;
}
}
......@@ -101,7 +101,7 @@ public class InputTouch : MonoBehaviour
//Vlt nicht auf nem Button möglich
else if (Mathf.Abs(richtungsVector.x) <= 2 && Mathf.Abs(richtungsVector.y) <= 2)
{
Debug.Log("Input Punkt Richtung: " + -((Camera.main.gameObject.transform.position - end).x));
//Debug.Log("Input Punkt Richtung: " + -((Camera.main.gameObject.transform.position - end).x));
groupController.MoveHorizontal(-((Camera.main.gameObject.transform.position - end).x));
}
}
......
fileFormatVersion: 2
guid: 81db3be97adf90a4cbb4f2ac628a927f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 7623bf2c50f68e54bb8f2e163cdb3994
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 3036aa983f5cf95408bf54052584f058
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: e6e89c6e99ebbf4419ae60663f3e8429
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Supports Markdown
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