Пример #1
0
	public void Init()
	{
		myAnimator = GetComponentInChildren<Animator>();

		IsFacingLeft = Random.Range(0, 2) > 0;
		float x = IsFacingLeft ? Globals.MAP_MAX_X : Globals.MAP_MIN_X;
			//GameController.Instance.MainCamera.ViewportToWorldPoint(new Vector3((IsFacingLeft ? 1f: 0f), 0f, 0f)).x;

		if(IsFacingLeft)
		{
			CurrentState = EBeastState.RunningLeft;

			Vector3 newScale = this.transform.localScale;
			newScale.x *= -1;
			this.transform.localScale = newScale;
		}
		else
		{
			CurrentState = EBeastState.RunningRight;
		}

		Vector3 pos = this.transform.localPosition;
		pos.x = x;
		pos.y = 0f;
		this.transform.localPosition = pos;
	}
Пример #2
0
	public void Attack()
	{
		if(myAnimator != null)
			myAnimator.Play("attack");
		CurrentState = EBeastState.EatingCultist;
	}
Пример #3
0
	public void Die()
	{
		if(myAnimator != null)
			myAnimator.Play("death");
		CurrentState = EBeastState.Dying;
	}