Ejemplo n.º 1
0
	// Use this for initialization
	void Start () {
		animator = GetComponent<Animator> ();
		source = GetComponent<AudioSource>();
		currstate = WallowState.IdleMove;
		currentTime = 0;
		hitblink = false;
		healthtext.text = "Health: " + health.ToString ();
		//health = 15;
		//swipeTransform = swipe.GetComponent<Transform> ();
	}
Ejemplo n.º 2
0
	// Update is called once per frame
	void Update () {
		// decrement swing fire rate
		if (currentTime > 0) {
			currentTime--;
		} else {
			currstate = WallowState.IdleMove;
			hitblink = false;
		}

		float xface = animator.GetFloat ("InputX");
		float yface = animator.GetFloat ("InputY");
		switch (currstate) {
		//Idle
		case WallowState.IdleMove:
			if (Input.GetButtonDown ("Sword")) {
				currstate = WallowState.Swipe;
				currentTime = swingTime;
			} else if (Input.GetButtonDown ("Fire")) {
				currstate = WallowState.AbilityFire;
				currentTime = swingTime;
			} else if (Input.GetButtonDown ("Whip")) {
				currstate = WallowState.AbilityWhip;
				currentTime = swingTime;
			}
			break;
		case WallowState.Swipe:
			if (currentTime==(swingTime-2)){
				// activate collision trigger dependent on current input axis
				// moving left
				if (xface < 0){
					//Debug.Log ("swipe left!");
					Instantiate(swipe, weaponWest.position, weaponWest.rotation);
				}
				// moving right
				else if (xface > 0){
					//Debug.Log ("swipe right!");
					Instantiate(swipe, weaponEast.position, weaponEast.rotation);
				}
				// moving up
				else if (yface > 0){
					//Debug.Log ("swipe up!");
					Instantiate(swipe, weaponNorth.position, weaponNorth.rotation);
				}
				// moving down OR idle
				else{
					//Debug.Log ("swipe down!");
					Instantiate(swipe, weaponSouth.position, weaponSouth.rotation);
				}
			}
			break;
		case WallowState.AbilityFire:
			if (currentTime==(swingTime-2)){
				// activate collision trigger dependent on current input axis
				// moving left
				if (xface < 0){
					//Debug.Log ("swipe left!");
					Instantiate(fireball, weaponWest.position, weaponWest.rotation);
				}
				// moving right
				else if (xface > 0){
					//Debug.Log ("swipe right!");
					Instantiate(fireball, weaponEast.position, weaponEast.rotation);
				}
				// moving up
				else if (yface > 0){
					//Debug.Log ("swipe up!");
					Instantiate(fireball, weaponNorth.position, weaponNorth.rotation);
				}
				// moving down OR idle
				else{
					//Debug.Log ("swipe down!");
					Instantiate(fireball, weaponSouth.position, weaponSouth.rotation);
				}
			}
			break;
		case WallowState.AbilityWhip:
			if (currentTime==(swingTime-2)){
				// activate collision trigger dependent on current input axis
				// moving left
				if (xface < 0){
					//Debug.Log ("swipe left!");
					Instantiate(whip, weaponWest.position, weaponWest.rotation);
				}
				// moving right
				else if (xface > 0){
					//Debug.Log ("swipe right!");
					Instantiate(whip, weaponEast.position, weaponEast.rotation);
				}
				// moving up
				else if (yface > 0){
					//Debug.Log ("swipe up!");
					Instantiate(whip, weaponNorth.position, weaponNorth.rotation);
				}
				// moving down OR idle
				else{
					//Debug.Log ("swipe down!");
					Instantiate(whip, weaponSouth.position, weaponSouth.rotation);
				}
			}
			break;
		case WallowState.Hurt:
			break;
		case WallowState.Death:
			if (currentTime <= 0) {
				
				//Destroy (this.gameObject);
				Scene scene = SceneManager.GetActiveScene();
				//scene.name; yields name of scene
				// go back to pre rigging scene
				// reset rigs
				if(scene.name == "2.1 Getting Burned"){
					GameManager.instance.rigReset(1);
					GameManager.instance.ChangeToScene("1.2 Cake and Insults");
				}
				else if(scene.name == "3.1 Now Watch Me Whip"){
					GameManager.instance.rigReset(2);
					GameManager.instance.ChangeToScene("2.3 Wallow's Room");
				}
				else if(scene.name == "4.1 Bragging and the Final Bout"){
					GameManager.instance.rigReset(3);
					GameManager.instance.ChangeToScene("3.1.3 Wallow's Room");
				}
			}
			break;
		case WallowState.Victory:
			break;
		}

	}
Ejemplo n.º 3
0
	void StartDancing()
	{
		hitblink = true;
		currentTime = 160;
		currstate = WallowState.Victory;
	}
Ejemplo n.º 4
0
	//Take Damage
	void ApplyDamage(int damageamount)
	{
		if (hitblink == false)
		{
			hitblink = true;
			currentTime = 30;
			health -= damageamount;
			healthtext.text = "Health: " + health.ToString ();
			float vol = Random.Range (volLowRange, volHighRange);
			if (health <= 0){
				source.PlayOneShot(dieSound,vol);
				currstate = WallowState.Death;
			}else{
				source.PlayOneShot(hitSound,vol);
				currstate = WallowState.Hurt;
			}
		}
	}