This commit is contained in:
Gerard Gascón 2025-04-24 14:30:07 +02:00
commit 102013b228
1443 changed files with 1065651 additions and 0 deletions

View file

@ -0,0 +1,46 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ChairsChairController : MonoBehaviour
{
public bool occupied;
public bool assigned;
[SerializeField] ChairsGameController gameController;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void AssignSeat()
{
this.occupied = true;
gameController.OccupyChair(this);
}
/*
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Enemy"))
{
if (occupied)
{
other.GetComponent<ChairsEnemyController>().ChooseNewChair();
}
else
{
occupied = true;
}
}
}*/
}

View file

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

View file

@ -0,0 +1,310 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class ChairsEnemyController : MonoBehaviour
{
[SerializeField] public Animator anim;
[SerializeField] const float normalSpeed = 6f;
[SerializeField] const float stunnedSpeed = 3f;
//float speed = 6;
[SerializeField] NavMeshAgent agent;
[SerializeField] ChairsGameController gameController;
[SerializeField] ChairsChairController targetChair;
//[SerializeField] float gravity = -9.8f;
[SerializeField] float findNewChairDelay;
[SerializeField] float stunCoolDown;
float actualStunCoolDown;
[SerializeField] float stunDuration;
public bool sat = false;
/*[HideInInspector]*/ public Vector3 startPosition;
//bool canMove = true;
public bool stunned = false;
public bool paused = false;
void Start()
{
startPosition = this.transform.position;
}
public void InitGame()
{
SetInitialTargetChair();
agent.SetDestination(targetChair.gameObject.transform.position);
SetNewTargetChair();
}
public void SetInitialTargetChair()
{
float maxDistance = float.PositiveInfinity;
int selectedIndex = 0;
for (int i = 0; i < gameController.freeChairs.Count; i++)
{
if (!gameController.freeChairs[i].occupied)
{
float distance = Vector3.Distance(this.transform.position, gameController.freeChairs[i].gameObject.transform.position);
if (distance < maxDistance)
{
selectedIndex = i;
maxDistance = distance;
}
}
}
targetChair = gameController.freeChairs[selectedIndex];
}
public void SetNewTargetChair()
{
StartCoroutine(SetNewTargetChairCoroutine());
}
public IEnumerator SetNewTargetChairCoroutine()
{
while (!sat && gameController.freeChairs.Count> 0)
{
if (!this.stunned)
{
float maxDistance = float.PositiveInfinity;
int selectedIndex = 0;
for (int i = 0; i < gameController.freeChairs.Count; i++)
{
if (!gameController.freeChairs[i].occupied)
{
NavMeshPath path = new NavMeshPath();
agent.CalculatePath(gameController.freeChairs[i].transform.position, path);
float distance = GetPathLength(path);/*= Vector3.Distance(this.transform.position, gameController.freeChairs[i].gameObject.transform.position)*/
if (distance < maxDistance)
{
selectedIndex = i;
maxDistance = distance;
}
}
}
if (targetChair == null)
{
ChairsChairController chair = gameController.freeChairs[selectedIndex];
targetChair = chair;
if (!this.stunned)
{
agent.SetDestination(chair.gameObject.transform.position);
Debug.Log("Se setea nuevo destino por silla null");
}
} else if (!targetChair.Equals(gameController.freeChairs[selectedIndex]))
{
ChairsChairController chair = gameController.freeChairs[selectedIndex];
targetChair = chair;
if (!this.stunned)
{
agent.SetDestination(chair.gameObject.transform.position);
Debug.Log("Se setea nuevo destino por nueva silla mas cercana");
}
}
}
yield return new WaitForSecondsRealtime(findNewChairDelay);
}
}
private float GetPathLength(NavMeshPath path)
{
float lng = 0.0f;
if ((path.status != NavMeshPathStatus.PathInvalid))
{
for (int i = 1; i < path.corners.Length; ++i)
{
lng += Vector3.Distance(path.corners[i - 1], path.corners[i]);
}
}
return lng;
}
// Update is called once per frame
void Update()
{
if (actualStunCoolDown != 0)
{
actualStunCoolDown -= Time.deltaTime;
if (actualStunCoolDown < 0)
{
actualStunCoolDown = 0;
}
}
if (stunned || paused)
{
agent.SetDestination(this.transform.position);
} else
{
anim.SetFloat("VelocityX", agent.velocity.x);
anim.SetFloat("VelocityY", agent.velocity.z);
}
/*
if (targetChair != null && !stunned && canMove)
{
var targetRotation = Quaternion.LookRotation(targetChair.position - transform.position);
// Smoothly rotate towards the target point.
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, 3 * Time.deltaTime);
Vector3 targetPos = new Vector3(targetChair.position.x, 0f, targetChair.position.z);
transform.position = Vector3.MoveTowards(transform.position, targetPos, speed * Time.deltaTime);
}else if (stunned)
{
if (moveLeft)
{
controller.Move(Vector3.left * Time.deltaTime);
}
if (moveRight)
{
controller.Move(Vector3.right * Time.deltaTime);
}
StartCoroutine(StopStunned());
}
*/
}
public void ChooseNewChair()
{
targetChair = null;
for (int i = 0; i < gameController.freeChairs.Count; i++)
{
if (!gameController.freeChairs[i].GetComponent<ChairsChairController>().occupied)
{
targetChair = gameController.freeChairs[i];
}
}
}
public void ResetEnemy()
{
//agent.enabled = false;
agent.Warp(startPosition);
transform.rotation = new Quaternion(0, 0, 0, 0);
//agent.enabled = true;
//enemy.gameObject.SetActive(true);
//this.sat = false;
this.stunned = false;
this.targetChair = null;
SetNewTargetChair();
}
private void ResetAnimation()
{
anim.SetFloat("VelocityX", 0);
anim.SetFloat("VelocityY", 0);
}
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Enemy"))
{
ChairsEnemyController enemy = other.GetComponent<ChairsEnemyController>();
DecideStun(enemy);
}
else if (other.CompareTag("Player"))
{
ChairsPlayerController enemy = other.GetComponent<ChairsPlayerController>();
DecideStun(enemy);
}
if (other.CompareTag("Chair"))
{
ChairsChairController chair = other.GetComponent<ChairsChairController>();
if (!chair.occupied)
{
this.sat = true;
chair.AssignSeat();
ResetAnimation();
}
}
}
private void DecideStun(ChairsEnemyController enemy)
{
float decision = Random.Range(0, 3);
if (decision < 1)
{
if (actualStunCoolDown == 0 && !enemy.stunned) {
Stun(enemy);
actualStunCoolDown = stunCoolDown;
}
}
}
private void DecideStun(ChairsPlayerController enemy)
{
float decision = Random.Range(0, 5);
if (decision < 1)
{
if (actualStunCoolDown == 0 && !enemy.stunned)
{
Stun(enemy);
actualStunCoolDown = stunCoolDown;
}
}
}
private void Stun(ChairsEnemyController enemy)
{
enemy.StunMyself();
}
private void Stun(ChairsPlayerController enemy)
{
enemy.StunMyself();
}
public void StunMyself()
{
stunned = true;
StartCoroutine(StunMyselfCoroutine());
}
private IEnumerator StunMyselfCoroutine()
{
Debug.Log("Me stuneo " + this.gameObject.name);
agent.isStopped = true;
ResetAnimation();
yield return new WaitForSecondsRealtime(stunDuration);
Debug.Log("Me termino el stuneo " + this.gameObject.name);
agent.isStopped = false;
stunned = false;
this.targetChair = null;
SetNewTargetChair();
}
/*
public void ResetAnim()
{
anim.SetFloat("VelocityX", 0);
anim.SetFloat("VelocityY", 0);
}*/
public void Loose()
{
anim.SetTrigger("DieWithoutGettingUp");
}
}

View file

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

View file

@ -0,0 +1,374 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
using Cinemachine;
using System.Threading;
public class ChairsGameController : MonoBehaviour
{
[SerializeField] ScenesTransitionController scenesTransition;
[SerializeField] CinemachineVirtualCamera cameraCutscene;
[SerializeField] CinemachineVirtualCamera cameraGame;
[SerializeField] CinemachineVirtualCamera cameraEndOfRound;
[SerializeField] float initialCinematicVelocity;
[SerializeField] GameObject tutorialPanel;
[SerializeField] GameObject countdownPanel;
[SerializeField] GameObject gameOverPanel;
[SerializeField] float timeBetweenRoundsAfterCam;
[SerializeField] float velocityCamBetweenRounds;
[SerializeField] NavMeshSurface surface;
[SerializeField] GameObject[] obstacles1;
[SerializeField] GameObject[] obstacles2;
[SerializeField] GameObject[] obstacles3;
[SerializeField] GameObject[] obstacles4;
[SerializeField] ChairsChairController[] chairs;
/*[HideInInspector]*/
public List<ChairsChairController> chairsPlaying;
/*[HideInInspector]*/
public List<ChairsChairController> freeChairs;
[SerializeField] ChairsEnemyController[] enemies;
/*[HideInInspector]*/
public List<ChairsEnemyController> enemiesPlaying;
[SerializeField] ChairsPlayerController player;
[SerializeField] int numberOfRounds;
[SerializeField] private int actualRound = 1;
private bool prueba = false;
bool scoreDistributed;
private void Awake()
{
chairsPlaying = new List<ChairsChairController>(chairs);
enemiesPlaying = new List<ChairsEnemyController>(enemies);
StartCoroutine(AudioManager.instance.FadeIn("transicion", 1));
PrepareMap();
}
private void Start()
{
}
public void StartGame()
{
StartCoroutine(BeforeStartGame());
}
private IEnumerator BeforeStartGame()
{
//Fin Cinematica
yield return new WaitForSecondsRealtime(0.5f);
countdownPanel.SetActive(true);
StartCoroutine(AudioManager.instance.FadeOut("transicion", 1));
StartCoroutine(AudioManager.instance.FadeIn("03_sillas", 1));
yield return new WaitForSecondsRealtime(4f);
//tutorialPanel.SetActive(false);
countdownPanel.SetActive(false);
AudioManager.instance.PlayOneShot("SFX_silbato");
SetChairs();
StartEnemies();
InitRound();
}
private void StartEnemies()
{
foreach (ChairsEnemyController enemy in enemies)
{
enemy.InitGame();
}
}
private void InitRound()
{
PausePlayers(false);
}
private void ResetMap()
{
foreach (GameObject obstacle in obstacles1)
{
if (!obstacle.activeSelf)
{
obstacle.SetActive(true);
break;
}
}
foreach (GameObject obstacle in obstacles2)
{
if (!obstacle.activeSelf)
{
obstacle.SetActive(true);
break;
}
}
foreach (GameObject obstacle in obstacles3)
{
if (!obstacle.activeSelf)
{
obstacle.SetActive(true);
break;
}
}
foreach (GameObject obstacle in obstacles4)
{
if (!obstacle.activeSelf)
{
obstacle.SetActive(true);
break;
}
}
}
private void PrepareMap()
{
ResetMap();
int obstacleToEliminate = Random.Range(0, obstacles1.Length);
obstacles1[obstacleToEliminate].SetActive(false);
obstacleToEliminate = Random.Range(0, obstacles2.Length);
obstacles2[obstacleToEliminate].SetActive(false);
obstacleToEliminate = Random.Range(0, obstacles3.Length);
obstacles3[obstacleToEliminate].SetActive(false);
obstacleToEliminate = Random.Range(0, obstacles4.Length);
obstacles4[obstacleToEliminate].SetActive(false);
//surface.BuildNavMesh();
}
private void SetChairs()
{
freeChairs = new List<ChairsChairController>(chairsPlaying);
}
private void SetEnemies()
{
enemiesPlaying = new List<ChairsEnemyController>(enemies);
}
public void OccupyChair(ChairsChairController chair)
{
freeChairs.Remove(chair);
if (freeChairs.Count == 0)
{
GameOver();
}
}
private void GameOver()
{
Debug.Log("Fin de ronda");
if (!player.sat)
{
player.sat = false;
Debug.Log("Termina porque player no sentado, ronda: " + actualRound);
FinishGame();
return;
}
if (actualRound < numberOfRounds)
{
player.sat = false;
actualRound++;
StartCoroutine(WaitEndOfRound());
}
else
{
Debug.Log("Termina por rondas");
FinishGame();
}
}
private IEnumerator WaitEndOfRound()
{
//AudioManager.instance.Play("transicion");
LooseEnemies(); //Para animacion
PausePlayers(true);
cameraGame.gameObject.SetActive(false);
cameraEndOfRound.gameObject.SetActive(true);
Vector3 initialPosOfCamera = cameraEndOfRound.transform.position;
yield return new WaitForSecondsRealtime(timeBetweenRoundsAfterCam);
PrepareMap();
//yield return new WaitForSecondsRealtime(timeBetweenRoundsAfterCam/2);
float i = 0;
while (i < 1.5)
{
i += Time.deltaTime;
cameraEndOfRound.transform.Translate(Vector3.back * Time.deltaTime * velocityCamBetweenRounds, Space.World);
yield return null;
}
//yield return new WaitForSecondsRealtime(timeBetweenRoundsAfterCam/2);
ResetPlayersPosition();
EliminatePlayersAndChairs();
i = 0;
while (i < 1)
{
i += Time.deltaTime;
cameraEndOfRound.transform.Translate(Vector3.back * Time.deltaTime * velocityCamBetweenRounds, Space.World);
yield return null;
}
cameraGame.gameObject.SetActive(true);
cameraEndOfRound.gameObject.SetActive(false);
countdownPanel.SetActive(true);
yield return new WaitForSecondsRealtime(4);
cameraEndOfRound.transform.position = initialPosOfCamera;
countdownPanel.SetActive(false);
PausePlayers(false);
player.sat = false;
foreach (ChairsEnemyController enemy in enemiesPlaying)
{
enemy.SetNewTargetChair();
}
}
private void PausePlayers(bool mode)
{
player.paused = mode;
foreach (ChairsEnemyController enemy in enemiesPlaying)
{
enemy.paused = mode;
}
}
private void LooseEnemies()
{
foreach (ChairsEnemyController enemy in enemiesPlaying)
{
if (!enemy.sat)
{
enemy.Loose();
}
}
}
private void ResetPlayersPosition()
{
ResetPlayer();
foreach (ChairsEnemyController enemy in enemiesPlaying)
{
//ResetEnemy(enemy);
enemy.ResetEnemy();
}
}
private void ResetPlayer()
{
//Debug.Log("Esta en:" + player.transform.position + " y quiere ir a " + player.startPosition);
// Debug.Log("Reseteo del player");
//player.sat = false;
CharacterController charController = player.GetComponent<CharacterController>();
charController.enabled = false;
player.transform.position = player.startPosition;
player.transform.rotation = new Quaternion(0, 0, 0, 0);
charController.enabled = true;
//player.gameObject.SetActive(true);
player.stunned = false;
player.ResetAnim();
//player.sat = false;
//Debug.Log("Ha llegado a: " + player.transform.position);
}
private void ResetEnemy(ChairsEnemyController enemy)
{
//enemy.gameObject.SetActive(false);
NavMeshAgent agent = enemy.GetComponent<NavMeshAgent>();
//agent.enabled = false;
enemy.transform.position = enemy.startPosition;
player.transform.rotation = new Quaternion(0, 0, 0, 0);
//agent.enabled = true;
//enemy.gameObject.SetActive(true);
enemy.sat = false;
enemy.stunned = false;
//enemy.SetNewTargetChair();
}
private void EliminatePlayersAndChairs()
{
int indexToEliminate = -1;
for (int i = 0; i < enemiesPlaying.Count; i++)
{
if (!enemiesPlaying[i].sat)
{
indexToEliminate = i;
}
else
{
enemiesPlaying[i].sat = false;
}
}
ChairsEnemyController enemy = enemiesPlaying[indexToEliminate];
enemy.gameObject.SetActive(false);
enemiesPlaying.RemoveAt(indexToEliminate);
player.sat = false;
for (int i = 0; i < chairsPlaying.Count; i++)
{
chairsPlaying[i].occupied = false;
}
indexToEliminate = Random.Range(0, chairsPlaying.Count);
ChairsChairController silla = chairsPlaying[indexToEliminate];
silla.gameObject.SetActive(false);
chairsPlaying.RemoveAt(indexToEliminate);
SetChairs();
}
private void FinishGame()
{
Debug.Log("Fin de partida");
//Ver en que ronda estaba cuando se perdio
//Si no es el la ultima, calcular tu posicion e inventar las de los que quedan
//Si es la ultima, ver si has ganado o perdido
StartCoroutine(AudioManager.instance.FadeOut("03_sillas", 1));
if (player.sat)
{
player.paused = true;
ReturnToMenu(player.gameObject.GetComponent<CharacterIdController>().CharacterId);
}
else
{
player.Loose();
if (BetweenScenePass.instance && BetweenScenePass.instance.NpcCharacterId.Count > 0)
ReturnToMenu(BetweenScenePass.instance.NpcCharacterId[Random.Range(0, BetweenScenePass.instance.NpcCharacterId.Count - 1)]);
else
ReturnToMenu(3);
}
}
private void Update()
{
if (prueba)
{
//Debug.Log(player.transform.position);
}
}
void ReturnToMenu(int winner)
{
if (!scoreDistributed)
{
StartCoroutine(BetweenScenePass.instance.DistributeScore(
BetweenScenePass.Games.Chairs,
winner,
scenesTransition));
scoreDistributed = true;
}
}
}

View file

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

View file

@ -0,0 +1,267 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ChairsPlayerController : MonoBehaviour
{
[SerializeField] Animator anim;
[SerializeField] CharacterController controller = default;
[SerializeField] Transform cam = default;
[SerializeField] ChairsGameController gameController;
[SerializeField] float minSpeed;
[SerializeField] float maxSpeed;
[SerializeField] float aceleration;
[SerializeField] float speed = 6;
[SerializeField, Range(0, 2f)] float turnSmoothTime = .1f;
float turnSmoothVelocity;
[Header("Jump")]
[SerializeField, Min(0)] float gravity = 15f;
[SerializeField] float jumpHeight = 3f;
[SerializeField, Range(0, .5f)] float jumpDelay = .5f;
Vector3 velocity;
[SerializeField] Transform groundCheck = default;
[SerializeField, Range(0, .5f)] float groundDistance = .4f;
[SerializeField] LayerMask groundMask = -1;
bool isGrounded;
[SerializeField, Range(0f, .3f)] float jumpPressedRememberTime = .2f;
float jumpPressedRemember;
[Header("Randomize Target X")]
[SerializeField] float randomX = 0;
[SerializeField] float randomZ = 0;
[SerializeField] float stunDuration;
private float actualStunCoolDown;
[SerializeField] private float stunCoolDown;
/*[HideInInspector]*/
public Vector3 startPosition;
bool randomMove = false;
/*[HideInInspector]*/
public bool sat = false;
public bool paused = false;
private float lastSped;
private float lastHorizontal;
private float lastVertical;
private Vector3 lastDir;
[SerializeField, Range(0, 1f)] float stepsInterval = .35f;
float currentStepTime;
Vector3 randomDirection;
/*
Vector3[] directions = {
Vector3.right,
Vector3.left,
Vector3.back
};
*/
[HideInInspector] public bool stunned = false;
void Awake()
{
//Cursor.lockState = CursorLockMode.Locked;
//StartCoroutine(SetRandomDirection());
startPosition = this.transform.position;
anim = GetComponent<CharacterIdController>().SetPlayerCustom();
}
/*
IEnumerator SetRandomDirection()
{
randomMove = true;
randomDirection = directions[Random.Range(0, directions.Length)];
yield return new WaitForSeconds(Random.Range(0.5f, 1f));
randomMove = false;
yield return new WaitForSeconds(Random.Range(1f, 2f));
StartCoroutine(SetRandomDirection());
}*/
// Update is called once per frame
void Update()
{
if (!paused)
{
if (!sat && !stunned)
{
isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);
if (isGrounded && velocity.y < 0)
{
velocity.y = -2f;
}
float horizontal = Input.GetAxisRaw("Horizontal");
float vertical = Input.GetAxisRaw("Vertical");
Vector3 direction = new Vector3(horizontal, 0, vertical).normalized;
if (direction.magnitude >= .1f)
{
float targetAngle = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg + cam.eulerAngles.y;
float angle = Mathf.SmoothDampAngle(transform.eulerAngles.y, targetAngle, ref turnSmoothVelocity, turnSmoothTime);
//transform.rotation = Quaternion.Euler(0f, angle, 0f);
Vector3 moveDir = Quaternion.Euler(0f, targetAngle, 0f) * Vector3.forward;
if (randomMove)
{
moveDir = Quaternion.Euler(0f, targetAngle, 0f) * randomDirection;
}
moveDir = moveDir.normalized;
/*moveDir.x += randomX;
moveDir.z += randomZ;*/
if (speed < maxSpeed)
{
speed += aceleration * Time.deltaTime;
}
lastDir = moveDir;
lastSped = speed;
controller.Move(moveDir * speed * Time.deltaTime);
currentStepTime += Time.deltaTime;
if (currentStepTime >= stepsInterval){
AudioManager.instance.PlayOneShot("SFX_paso" + Random.Range(1, 6), true);
currentStepTime = 0;
}
anim.SetFloat("VelocityX", horizontal);
anim.SetFloat("VelocityY", vertical);
} else
{
ResetAnim();
}
jumpPressedRemember -= Time.deltaTime;
if (Input.GetButtonDown("Jump"))
{
jumpPressedRemember = jumpPressedRememberTime;
}
if (jumpPressedRemember > 0f && isGrounded)
{
StartCoroutine(Jump(jumpDelay));
jumpPressedRemember = 0;
}
velocity.y -= gravity * Time.deltaTime;
controller.Move(velocity * Time.deltaTime);
}
if (actualStunCoolDown != 0)
{
actualStunCoolDown -= Time.deltaTime;
if (actualStunCoolDown < 0)
{
actualStunCoolDown = 0;
}
}
}
}
IEnumerator Jump(float delay)
{
yield return new WaitForSeconds(delay);
velocity.y = Mathf.Sqrt(jumpHeight * 2f * gravity);
jumpPressedRemember = 0;
StopCoroutine("Jump");
}
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Chair"))
{
ChairsChairController chair = other.GetComponent<ChairsChairController>();
if (!chair.occupied)
{
this.sat = true;
chair.AssignSeat();
ResetAnim();
AudioManager.instance.PlayOneShot("SFX_campanillas");
}
}
if (other.CompareTag("Enemy"))
{
ChairsEnemyController enemy = other.GetComponent<ChairsEnemyController>();
DecideStun(enemy);
}
}
private void DecideStun(ChairsEnemyController enemy)
{
float decision = Random.Range(0, 3);
if (decision < 1)
{
if (actualStunCoolDown == 0 && !enemy.stunned)
{
Stun(enemy);
actualStunCoolDown = stunCoolDown;
}
}
}
public void Loose()
{
anim.SetTrigger("DieWithoutGettingUp");
paused = true;
}
public void ResetAnim()
{
anim.SetFloat("VelocityX", 0);
anim.SetFloat("VelocityY", 0);
}
private void Stun(ChairsEnemyController enemy)
{
enemy.StunMyself();
}
public void StunMyself()
{
stunned = true;
StartCoroutine(StunMyselfCoroutine());
}
private IEnumerator StunMyselfCoroutine()
{
ResetAnim();
yield return new WaitForSecondsRealtime(stunDuration);
stunned = false;
//anim.SetBool("Stunned", false);
}
/*
void OnDrawGizmos()
{
if (groundCheck != null)
{
Gizmos.color = Color.red;
Gizmos.DrawWireSphere(groundCheck.position, groundDistance);
}
}*/
}

View file

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