Commit 05832494 authored by Philipp Rademacher's avatar Philipp Rademacher
Browse files

Merge branch 'Gamelogic_Philipp'

parents 242a85b3 31f8b038
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BatBoomerang : MonoBehaviour
{
private Vector2 spawnPosition,targetPosition;
//private GameObject
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
}
}
fileFormatVersion: 2
guid: b829e9b6907fda440bc3380f6e662b9f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -21,11 +21,14 @@ public class PlayerJump : MonoBehaviour {
pStateManager.rigidb.velocity = new Vector2(pStateManager.rigidb.velocity.x, pStateManager.jumpSpeed);
}
// kann fuers gleiten benutzt werden
/*
if(pStateManager.jump_Input == false && pStateManager.grounded == false)
{
if(pStateManager.vertical < 0)
if (pStateManager.vertical < 0)
pStateManager.rigidb.velocity = new Vector2(pStateManager.rigidb.velocity.x, -1);
}
*/
}
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Projectile : MonoBehaviour
{
public int projectileSpeed;
public Vector2 projectileDir;
public GameObject self;
private float delta = 0;
Rigidbody2D rig;
private void Start()
{
rig = GetComponent<Rigidbody2D>();
}
private void Update()
{
delta += Time.deltaTime;
rig.velocity = projectileDir * projectileSpeed;
if (delta > 5)
Destroy(self);
}
public void InitProjectile(int projectileSpeed, Vector2 dir,GameObject self)
{
this.projectileSpeed = projectileSpeed;
this.projectileDir = dir;
this.self = self;
}
}
fileFormatVersion: 2
guid: 831aa557cdcff2242a49a96922e4c963
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -2,31 +2,29 @@
using System.Collections.Generic;
using UnityEngine;
public class ProjectileSpawner : MonoBehaviour {
public class ProjectileSpawner : MonoBehaviour
{
public GameObject projectile;
public int projectilSpeed = 6;
/*
public Rigidbody2D spawn;
public Rigidbody2D target;
public Rigidbody2D spawn;
public Rigidbody2D target;
float delta;
// Use this for initialization
void Start () {
delta = 0;
}
float delta = 0;
private void Update()
{
delta += Time.deltaTime;
if(delta > 5)
if (delta > 3)
{
delta = 0;
SpawnProjectile(spawn.position, target.position, false);
}
SpawnProjectile(spawn.position, target.position, true);
}
}
*/
public void SpawnProjectile(Vector2 spawnPosition, Vector2 target,bool target_seeking)
{
......@@ -34,7 +32,8 @@ public class ProjectileSpawner : MonoBehaviour {
float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
GameObject _Projectile = Instantiate(projectile,spawnPosition ,Quaternion.AngleAxis(angle, Vector3.forward));
_Projectile.GetComponent<Rigidbody2D>().velocity = direction*6;
_Projectile.GetComponent<Rigidbody2D>().velocity = direction * projectilSpeed;
_Projectile.GetComponent<Projectile>().InitProjectile(projectilSpeed, direction,_Projectile);
}
}
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