init
This commit is contained in:
commit
e0a842f222
796 changed files with 361371 additions and 0 deletions
50
Assets/Scripts/SpikeBehavior.cs
Normal file
50
Assets/Scripts/SpikeBehavior.cs
Normal file
|
@ -0,0 +1,50 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class SpikeBehavior : MyTypes.MyPawn{
|
||||
|
||||
public static int spikeAmount;
|
||||
|
||||
private Animator anim;
|
||||
private bool harming = false;
|
||||
|
||||
|
||||
public bool Harming
|
||||
{
|
||||
get
|
||||
{
|
||||
return harming;
|
||||
}
|
||||
set
|
||||
{
|
||||
|
||||
GetComponent<PlaySound>().PlayOneShot(value?"ErizoIn":"ErizoOut");
|
||||
harming = value;
|
||||
}
|
||||
}
|
||||
|
||||
void updateAnimation(bool value)
|
||||
{
|
||||
anim.SetBool("harming", value);
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Awake(){
|
||||
spikeAmount++;
|
||||
|
||||
anim = GetComponentInChildren<Animator>();
|
||||
}
|
||||
|
||||
private void Start(){
|
||||
StartCoroutine(ToggleState(3));
|
||||
}
|
||||
|
||||
|
||||
IEnumerator ToggleState(float time)
|
||||
{
|
||||
yield return new WaitForSeconds(time);
|
||||
updateAnimation(!Harming);
|
||||
StartCoroutine(ToggleState(3));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue