몬스터 에셋 추가
This commit is contained in:
8
Gameton-06/Assets/PixelFantasy/Common/Materials.meta
Normal file
8
Gameton-06/Assets/PixelFantasy/Common/Materials.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8677c2eb7ec9bbb4ebdb942dcb8a8069
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,11 @@
|
||||
%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: NoFrictionPhysicsMaterial2D
|
||||
friction: 0
|
||||
bounciness: 0
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b1c6f7475961704286628d9fc21c1f2
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 6200000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 269333
|
||||
packageName: Pixel Monsters Animated Boss Pack #1
|
||||
packageVersion: 2.7
|
||||
assetPath: Assets/PixelFantasy/Common/Materials/NoFrictionPhysicsMaterial2D.physicsMaterial2D
|
||||
uploadId: 656019
|
||||
8
Gameton-06/Assets/PixelFantasy/Common/Scripts.meta
Normal file
8
Gameton-06/Assets/PixelFantasy/Common/Scripts.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 14556cc77278f6248b985ed61205764f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
11
Gameton-06/Assets/PixelFantasy/Common/Scripts/Creature.cs
Normal file
11
Gameton-06/Assets/PixelFantasy/Common/Scripts/Creature.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets.PixelFantasy.Common.Scripts
|
||||
{
|
||||
public class Creature : MonoBehaviour
|
||||
{
|
||||
public SpriteRenderer Body;
|
||||
public Animator Animator;
|
||||
public AudioSource AudioSource;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe8f6eb3a4a94d398bb09abb4f01b61c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 269333
|
||||
packageName: Pixel Monsters Animated Boss Pack #1
|
||||
packageVersion: 2.7
|
||||
assetPath: Assets/PixelFantasy/Common/Scripts/Creature.cs
|
||||
uploadId: 656019
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets.PixelFantasy.Common.Scripts
|
||||
{
|
||||
[CreateAssetMenu(fileName = "EffectManager", menuName = "Pixel Heroes/EffectManager")]
|
||||
public class EffectManager : ScriptableObject
|
||||
{
|
||||
public SpriteEffect SpriteEffectPrefab;
|
||||
public AudioClip FireAudioClip;
|
||||
|
||||
private static Material _baseMaterial;
|
||||
private static Material _blinkMaterial;
|
||||
|
||||
public static EffectManager Instance;
|
||||
|
||||
[RuntimeInitializeOnLoadMethod]
|
||||
static void Initialize()
|
||||
{
|
||||
Instance = Resources.Load<EffectManager>("EffectManager");
|
||||
}
|
||||
|
||||
public void Blink(Creature creature)
|
||||
{
|
||||
if (_baseMaterial == null) _baseMaterial = creature.Body.sharedMaterial;
|
||||
if (_blinkMaterial == null) _blinkMaterial = new Material(Shader.Find("GUI/Text Shader"));
|
||||
|
||||
creature.StartCoroutine(BlinkCoroutine(creature));
|
||||
}
|
||||
|
||||
private IEnumerator BlinkCoroutine(Creature creature)
|
||||
{
|
||||
creature.Body.material = _blinkMaterial;
|
||||
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
|
||||
creature.Body.material = _baseMaterial;
|
||||
}
|
||||
|
||||
public SpriteEffect CreateSpriteEffect(Creature creature, string clipName, int direction = 0, Transform parent = null)
|
||||
{
|
||||
var instance = Instantiate(SpriteEffectPrefab, creature.transform.position, Quaternion.identity, parent);
|
||||
|
||||
instance.name = clipName;
|
||||
instance.transform.position = parent == null ? creature.transform.position : parent.transform.position;
|
||||
instance.GetComponent<SpriteRenderer>().sortingOrder = creature.Body.sortingOrder + 1;
|
||||
instance.Play(clipName, direction == 0 ? Math.Sign(creature.transform.localScale.x) : direction);
|
||||
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07308f8fd0684c440a2b1d8e03e28de0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 269333
|
||||
packageName: Pixel Monsters Animated Boss Pack #1
|
||||
packageVersion: 2.7
|
||||
assetPath: Assets/PixelFantasy/Common/Scripts/EffectManager.cs
|
||||
uploadId: 656019
|
||||
58
Gameton-06/Assets/PixelFantasy/Common/Scripts/SoloState.cs
Normal file
58
Gameton-06/Assets/PixelFantasy/Common/Scripts/SoloState.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets.PixelFantasy.Common.Scripts
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to block animation transitions.
|
||||
/// </summary>
|
||||
public class SoloState : StateMachineBehaviour
|
||||
{
|
||||
public bool Continuous;
|
||||
public bool Active;
|
||||
public Func<bool> Continue;
|
||||
|
||||
private float _enterTime;
|
||||
|
||||
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
{
|
||||
_enterTime = Time.time;
|
||||
animator.SetBool("Action", true);
|
||||
Active = true;
|
||||
}
|
||||
|
||||
public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
{
|
||||
if (stateInfo.normalizedTime >= 1 && !Continuous)
|
||||
{
|
||||
Exit(animator, stateInfo);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
{
|
||||
Exit(animator, stateInfo);
|
||||
}
|
||||
|
||||
private void Exit(Animator animator, AnimatorStateInfo stateInfo)
|
||||
{
|
||||
if (!Active || Time.time - _enterTime < stateInfo.length) return;
|
||||
|
||||
Active = false;
|
||||
|
||||
if (Continue == null)
|
||||
{
|
||||
animator.SetBool("Action", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Continue())
|
||||
{
|
||||
animator.SetBool("Action", false);
|
||||
}
|
||||
|
||||
Continue = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 292b9c94eb10446c952c82a8ebcca571
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 269333
|
||||
packageName: Pixel Monsters Animated Boss Pack #1
|
||||
packageVersion: 2.7
|
||||
assetPath: Assets/PixelFantasy/Common/Scripts/SoloState.cs
|
||||
uploadId: 656019
|
||||
@@ -0,0 +1,16 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets.PixelFantasy.Common.Scripts
|
||||
{
|
||||
[RequireComponent(typeof(SpriteRenderer))]
|
||||
[RequireComponent(typeof(Animator))]
|
||||
public class SpriteEffect : MonoBehaviour
|
||||
{
|
||||
public void Play(string clipName, int direction = 1)
|
||||
{
|
||||
transform.localScale = new Vector3(direction, 1, 1);
|
||||
GetComponent<Animator>().Play(clipName);
|
||||
Destroy(gameObject, 0.25f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 73404b8e595dc4543b2b9a8e8ef8fa4d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 269333
|
||||
packageName: Pixel Monsters Animated Boss Pack #1
|
||||
packageVersion: 2.7
|
||||
assetPath: Assets/PixelFantasy/Common/Scripts/SpriteEffect.cs
|
||||
uploadId: 656019
|
||||
Reference in New Issue
Block a user