Commit c91a1e5f authored by mthiele2's avatar mthiele2
Browse files

Player Feuer Angriff

parent 9f4bba95
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!62 &6200000
PhysicsMaterial2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: New Physics Material 2D
friction: 0
bounciness: 1
fileFormatVersion: 2
guid: efe81e074029f1a459557789404db09a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 6200000
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1870586037468468
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4127596686620136}
- component: {fileID: 50678955766023196}
- component: {fileID: 70840632841850180}
- component: {fileID: 212152556601460820}
- component: {fileID: 5567333940966867164}
m_Layer: 0
m_Name: Pre_PlayerFireAttack
m_TagString: EnemyShot
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4127596686620136
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1870586037468468}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.99, y: 1.86, z: -1}
m_LocalScale: {x: 1.49, y: 1.68, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!50 &50678955766023196
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1870586037468468}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 5
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
--- !u!70 &70840632841850180
CapsuleCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1870586037468468}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 6200000, guid: efe81e074029f1a459557789404db09a, type: 2}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_Size: {x: 0.19, y: 0.18}
m_Direction: 0
--- !u!212 &212152556601460820
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1870586037468468}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 1206248169
m_SortingLayer: 3
m_SortingOrder: 1
m_Sprite: {fileID: 10913, guid: 0000000000000000f000000000000000, type: 0}
m_Color: {r: 0.9245283, g: 0.07413671, b: 0.07413671, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 0.2, y: 0.2}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!114 &5567333940966867164
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1870586037468468}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 064e9cc5b6bebf64abbd9a46df327724, type: 3}
m_Name:
m_EditorClassIdentifier:
damage: 0
nearestPlayer: {fileID: 0}
destroyTime: 1
fileFormatVersion: 2
guid: e5f7d8895a3df6547bca926919077d19
timeCreated: 1526550566
licenseType: Free
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1997262709
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1997262710}
m_Layer: 8
m_Name: Shotspawn
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1997262710
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1997262709}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.72, y: -0.02, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7340435369038607274}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &7340435368843602584
GameObject:
m_ObjectHideFlags: 0
......@@ -46,6 +76,7 @@ GameObject:
- component: {fileID: 7340435369038607273}
- component: {fileID: 7340435369038607279}
- component: {fileID: 7340435369038607276}
- component: {fileID: 1475208695}
m_Layer: 8
m_Name: Player
m_TagString: Player
......@@ -66,6 +97,7 @@ Transform:
m_Children:
- {fileID: 7340435369394276830}
- {fileID: 7340435368843602585}
- {fileID: 1997262710}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......@@ -268,6 +300,23 @@ Animator:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!114 &1475208695
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7340435369038607268}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 83eb4399ff535ee4cbc76de3b8a32e46, type: 3}
m_Name:
m_EditorClassIdentifier:
Cooldown: 2
volleySize: 3
launchPower: 20
attackSpeed: 0.5
fireBall: {fileID: 1870586037468468, guid: e5f7d8895a3df6547bca926919077d19, type: 3}
--- !u!1 &7340435369394276825
GameObject:
m_ObjectHideFlags: 0
......
......@@ -320,14 +320,24 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7340435369038607272, guid: 938701439f7d9654da1b920d73ccf2cc,
type: 3}
propertyPath: m_JumpForce
value: 700
objectReference: {fileID: 0}
- target: {fileID: 7340435369038607275, guid: 938701439f7d9654da1b920d73ccf2cc,
type: 3}
propertyPath: m_Mass
- target: {fileID: 1475208695, guid: 938701439f7d9654da1b920d73ccf2cc, type: 3}
propertyPath: shotSpawn
value:
objectReference: {fileID: 1997262710}
- target: {fileID: 1475208695, guid: 938701439f7d9654da1b920d73ccf2cc, type: 3}
propertyPath: volleySize
value: 20
objectReference: {fileID: 0}
- target: {fileID: 1475208695, guid: 938701439f7d9654da1b920d73ccf2cc, type: 3}
propertyPath: launchPower
value: 30
objectReference: {fileID: 0}
- target: {fileID: 1475208695, guid: 938701439f7d9654da1b920d73ccf2cc, type: 3}
propertyPath: attackSpeed
value: 0.005
objectReference: {fileID: 0}
- target: {fileID: 1475208695, guid: 938701439f7d9654da1b920d73ccf2cc, type: 3}
propertyPath: Cooldown
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
......@@ -1010,23 +1020,6 @@ GameObject:
type: 3}
m_PrefabInstance: {fileID: 393328824}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1475208703
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1475208694}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2f8415a7fda2c084e87b3caa1b43ffbf, type: 3}
m_Name:
m_EditorClassIdentifier:
state: {fileID: 11400000, guid: c5777bcc7b64ce24c9bd65d2c4b7c639, type: 2}
onAirInfused: {fileID: 11400000, guid: b0928121a3619584c9612f68610a97a5, type: 2}
onEarthInfused: {fileID: 11400000, guid: 59d96edea2ecb434999c09413da7449a, type: 2}
onFireInfused: {fileID: 11400000, guid: f553df1a50d464e48837fbb6cb99b7e5, type: 2}
onWaterInfused: {fileID: 11400000, guid: ca31b08da78cb134086d7688bbb50628, type: 2}
--- !u!1 &1523356284
GameObject:
m_ObjectHideFlags: 0
......@@ -1575,6 +1568,12 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 4512b8eb550115443bbba2ecd59a960c, type: 3}
--- !u!4 &1997262710 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 1997262710, guid: 938701439f7d9654da1b920d73ccf2cc,
type: 3}
m_PrefabInstance: {fileID: 393328824}
m_PrefabAsset: {fileID: 0}
--- !u!1 &2027679585
GameObject:
m_ObjectHideFlags: 0
......
using UnityEngine;
using System.Collections.Generic;
using System.Collections;
public class AI_DashAttack : WeightedAction
{
GameObject nearestPlayer;
AI_Core myAI;
private float restCooldown;
private float windUpCooldown;
private bool windUpReady;
private bool attackDone;
private Rigidbody2D body;
public GameObject windAttack;
public float Cooldown;
public float attackRange;
public float dashSpeed;
public float windUpTime;
// Use this for initialization
void Start()
{
myAI = GetComponent<AI_Core>();
}
void CheckConditions()
{
nearestPlayer = myAI.findNearestPlayer();
float dist = Vector2.Distance(transform.position, nearestPlayer.transform.position);
if (!isPerformingAction)
{
if (dist > attackRange)
{
return;
}
}
Vector2 dir = Vector2.zero;
direction = dir;
myAI.desiredAction.Add(this);
}
public override void performAction()
{
Vector3 attackdir = nearestPlayer.transform.position - transform.position;
attackdir.Normalize();
if (windUpCooldown <= 0 && attackDone)
{
if (isPerformingAction)
{
isPerformingAction = false;
return;
}
StartCoroutine(windUp(attackdir));
windUpCooldown = windUpTime;
isPerformingAction = true;
}
else
{
restCooldown -= Time.deltaTime;
}
if (restCooldown <= 0 && windUpReady)
{
Fire(attackdir);
restCooldown = Cooldown;
}
else
{
restCooldown -= Time.deltaTime;
}
}
public void Fire(Vector3 attackdir)
{
GameObject projectile = Instantiate(windAttack, transform.position + attackdir, Quaternion.AngleAxis(Mathf.Atan2(-attackdir.y, -attackdir.x) * Mathf.Rad2Deg + 180, Vector3.forward));
body = projectile.GetComponent<Rigidbody2D>();
Vector3 rotatedVector = Quaternion.AngleAxis(0, Vector3.forward) * attackdir;
body.velocity = new Vector2(rotatedVector.x * 5, rotatedVector.y * 5);
}
IEnumerator windUp(Vector3 attackdir)
{
float updateTarget = windUpTime;
float currentTime = 0.0f;
//do
//{
// if (target != null)
// {
// if (currentTime >= updateTarget)
// {
// dir = target.transform.position - this.transform.position;
// dir.Normalize();
// updateTarget += timeToRefresh;
// }
// Vector3 newPosition = dir * movementSpeed * Time.deltaTime;
// transform.position += newPosition;
// }
// deathZone.transform.localScale = Vector3.Lerp(originalScale, destinationScale, currentTime / duration);
// currentTime += Time.deltaTime;
// AnimateEnemy();
yield return null;
//} while (currentTime <= duration);
}
}
fileFormatVersion: 2
guid: bb4a718ca19c7394999fdcd103f9129a
timeCreated: 1536939600
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -2,82 +2,42 @@ using UnityEngine;
using System.Collections.Generic;
using System.Collections;
public class Player_FireAttack : WeightedAction
public class Player_FireAttack : MonoBehaviour
{
GameObject nearestPlayer;
AI_Core myAI;
private float restCooldown;
private float nextFire;
public float Cooldown;
public float attackRange;
public int damage;
public GameObject shot;
List<GameObject> shots;
public float fireSpeed = 2f;
public int volleySize;
public int pooledAmount = 10;
public float launchPower = 20;
public float launchPower;
public float attackSpeed;
public Transform shotspawn;
public bool cluster;
public bool ricochet;
public Transform shotSpawn;
public GameObject fireBall;
private Rigidbody2D body;
// Use this for initialization
void Start()
private void Start()
{
myAI = GetComponent<AI_Core>();
nextFire = 0;
}
void CheckConditions()
private void Update()
{
nearestPlayer = myAI.findNearestPlayer();
float dist = Vector2.Distance(transform.position, nearestPlayer.transform.position);
if (dist > attackRange)
{
return;
}
Vector2 dir = Vector2.zero;
direction = dir;
myAI.desiredAction.Add(this);
}
if (Input.GetButtonDown("Fire1") && Time.time > nextFire)
{
Debug.Log("pla");
nextFire = nextFire + Cooldown;
public override void performAction()
{
if (restCooldown <= 0)
{
StartCoroutine(fireVolley());
restCooldown = Cooldown;
}
else
{
restCooldown -= Time.deltaTime;
StartCoroutine(fire());
}
}
IEnumerator fireVolley()
IEnumerator fire()
{
launchPower = 10;
for (int i = 0; i < volleySize; i++)
{
launchPower += 3;
GameObject projectile = Instantiate(shot, shotspawn.position, shotspawn.rotation);
if (nearestPlayer.transform.position.x > this.transform.position.x)
{
projectile.GetComponent<Rigidbody2D>().velocity = new Vector2(launchPower, launchPower);
}
else
{
projectile.GetComponent<Rigidbody2D>().velocity = new Vector2(-launchPower, launchPower);
}
GameObject projectile = Instantiate(fireBall, shotSpawn.position, shotSpawn.rotation);
Vector3 direction = shotSpawn.position - transform.position;
projectile.GetComponent<Rigidbody2D>().velocity = direction * launchPower;
yield return new WaitForSeconds(attackSpeed);
}
}
......
......@@ -39,11 +39,11 @@ public class Player_FireProjectile : MonoBehaviour
private void OnTriggerEnter2D(Collider2D target)
{
if (target.CompareTag("Enemy"))
{
return;
}
Destroy();
//if (target.CompareTag("Enemy"))
//{
// return;
//}
//Destroy();
}
}
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