Mob feautures

This commit is contained in:
dart 2022-04-03 03:01:22 +03:00
parent 25f5ca2982
commit d5d9357cf8
10 changed files with 262 additions and 15 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7beb512e9f6d1f6cf8d4e41d4b2cd856
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,158 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6196285449860538992
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4291895258293432843}
- component: {fileID: 4864008898460965936}
- component: {fileID: 6102265118150421119}
m_Layer: 0
m_Name: Square
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4291895258293432843
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6196285449860538992}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 1.15, y: -0.48, z: 1.3160809}
m_LocalScale: {x: 4.1, y: 0.18550389, z: 1}
m_Children: []
m_Father: {fileID: 4220328572880531123}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &4864008898460965936
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6196285449860538992}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
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_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!61 &6102265118150421119
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6196285449860538992}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0.00081826746, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 1, y: 1}
newSize: {x: 1, y: 1}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 0.9983634, y: 1}
m_EdgeRadius: 0
--- !u!1 &6863736067666425520
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4220328572880531123}
- component: {fileID: 7866767662200354342}
m_Layer: 0
m_Name: Ultraviolet
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4220328572880531123
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6863736067666425520}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -1.8834, y: 0.72714, z: -2.1158}
m_LocalScale: {x: 1.6076, y: 1.6076, z: 1.6076}
m_Children:
- {fileID: 4291895258293432843}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &7866767662200354342
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6863736067666425520}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 49f585561ea104de189705939209031c, type: 3}
m_Name:
m_EditorClassIdentifier:
beam: {fileID: 6196285449860538992}
rotationSpeed: 1
damage: 0

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: bc5b45bd6fa94ff02acf62aa17c345a1
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c63b17a518eaed3e193bafd9c6f89e90
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Ultraviolet : MonoBehaviour
{
[SerializeField] private GameObject beam;
[SerializeField] private float rotationSpeed;
[SerializeField] private float damage;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
//beam.transform.rotation.eulerAngles += new Vector3(0, 0 0.2f);
beam.transform.Rotate(new Vector3(0,0,1), rotationSpeed * Time.deltaTime);
}
void OnTriggerEnter2D(Collider2D col)
{
Debug.Log("PIZDAAAAAA");
if (col.gameObject.CompareTag("Mob"))
{
Debug.Log("PIZDAAAAAA");
col.gameObject.GetComponent<Mob>().SendMessage("ApplyDamage", damage);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 49f585561ea104de189705939209031c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -48,8 +48,8 @@ public StatReturn GetStats()
return stats;
}
public void ApplyDamage(float newDamage)
public void ApplyDamage(float damage)
{
damage += newDamage;
health -= damage;
}
}

View File

@ -1,7 +1,9 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using UnityEngine;
using UnityEngine.UI;
public class Mob : MonoBehaviour
{
@ -9,20 +11,28 @@ public class Mob : MonoBehaviour
[SerializeField] private OverMind overMind;
[SerializeField] private float moveSpeed;
[SerializeField] private float health;
[SerializeField] private float damage;
[SerializeField] private float minDist;
[SerializeField] private float maxDist;
//private Character character;
// Start is called before the first frame update
void Start()
[SerializeField] private TextMesh healthText;
public void ApplyDamage(float damage)
{
health -= damage;
}
// Update is called once per frame
void Update()
{
if (health < 0)
{
overMind.DeathGoToPull(gameObject);
}
healthText.text = health.ToString(CultureInfo.InvariantCulture);
//transform.LookAt(characterObject.transform);
if (Vector3.Distance(transform.position, characterObject.transform.position) >= minDist)
@ -69,17 +79,21 @@ void Update()
}
void OnTriggerEnter2D(Collider2D col)
{
Debug.Log("PIZDAAAAAA");
overMind.DeathGoToPull(gameObject);
}
private void Death()
{
if (col.gameObject.CompareTag("Character"))
{
characterObject.GetComponent<Character>().SendMessage("ApplyDamage", damage);
overMind.DeathGoToPull(gameObject);
}
//Debug.Log("PIZDAAAAAA");
}
public void SetupMob(OverMind.MobParameters mobParameters)
{
characterObject = mobParameters.Character;
moveSpeed = mobParameters.MoveSpeed;
overMind = mobParameters.OverMind;
health = mobParameters.Health;
damage = mobParameters.Damage;
}
}

View File

@ -10,6 +10,8 @@ public class OverMind : MonoBehaviour
[SerializeField] private GameObject characterObject;
[SerializeField] private float mobMoveSpeed;
[SerializeField] private float mobHealth;
[SerializeField] private float mobDamage;
[SerializeField] private GameObject mobPull;
[SerializeField] private GameObject activeMobs;
@ -32,6 +34,8 @@ public struct MobParameters
public float MoveSpeed;
public GameObject Character;
public OverMind OverMind;
public float Health;
public float Damage;
}
void Start()
@ -101,7 +105,9 @@ private void PreHeaterSpawn()
{
MoveSpeed = mobMoveSpeed,
Character = characterObject,
OverMind = this
OverMind = this,
Health = mobHealth,
Damage = mobDamage,
};
newMob.GetComponent<Mob>().SetupMob(newMobParameters);
@ -125,7 +131,7 @@ IEnumerator spawnMobsCourutine()
{
while(true)
{
Debug.Log ("OnCoroutine: "+(int)Time.time);
//Debug.Log ("OnCoroutine: "+(int)Time.time);
yield return new WaitForSeconds(1f);
var mobToSpawn = mobPull.transform.GetChild(0);

View File

@ -5,6 +5,7 @@ TagManager:
serializedVersion: 2
tags:
- Character
- Mob
layers:
- Default
- TransparentFX