Exemplo n.º 1
0
	// Use this for initialization
	void Start () {

		if (camScript == null)
		{
			GameObject player = GameObject.FindGameObjectWithTag("Player");
			camScript = player.transform.GetComponent<PuppetCameraScript>();
		}

		// initialize minimum distance to player
		if (minDist == 0.0f)
			minDist = 0.05f;
	}
Exemplo n.º 2
0
	//private float debugAngle;
	//private int debugDodgeType = 0;
	//private float debugDodgeTmr = 0.0f;
	//private int debugGrdType = 0;
	//private float debugGrdTmr = 0.0f;
	//private bool debugMove = false;
	//private bool debugCamera = false;
	//private bool debugDodge = false;
	//private bool debugGuard = false;
	#endregion



	// Use this for initialization
	void Start()
	{
		animation["New Down Slash"].time = 0.36667f;
		animation["New Left Slash"].time = 0.6f;
		animation["New Right Slash"].time = 0.63333f;
		// New things, added by Dakota 1/13 whatever PM
		// Needed a reference to the player in the meat script to decrement balance
		BloodyBag[] meats = gameObject.GetComponentsInChildren<BloodyBag>();

		for (int i = 0; i < meats.Length; i++)
			meats[i].player = gameObject;


		Object temp = GetComponent<PuppetAttackScript>();
		if (attackScript == null)
		{
			attackScript = (PuppetAttackScript)temp;
		}

		if (guardScript == null)
		{
			temp = GetComponent<PuppetGuardScript>();
			guardScript = (PuppetGuardScript)temp;
		}

		if (dodgeScript == null)
		{
			temp = GetComponent<PuppetDodgeScript>();
			dodgeScript = (PuppetDodgeScript)temp;
		}

		if (camScript == null)
		{
			temp = GetComponent<PuppetCameraScript>();
			camScript = (PuppetCameraScript)temp;
		}
		if (rhScript == null)
		{
			temp = GetComponent<PuppetResolveHitScript>();
			rhScript = (PuppetResolveHitScript)temp;
		}
		if (controller == null)
		{
			temp = GetComponent<CharacterController>();
			controller = (CharacterController)temp;
		}
		if (flashScript == null)
		{
			temp = GetComponentInChildren<MaterialFlash>();
			flashScript = (MaterialFlash)temp;
		}
		//badguys = GameObject.FindGameObjectsWithTag("Enemy");

		lastState = curState = State.IDLE;
		if (targOffset == Vector3.zero)
			targOffset.y = 3.0f;
		if (targMaxDist == 0.0f)
			targMaxDist = 200.0f;
		if (moveSpeed == 0.0f)
			moveSpeed = 5.0f;
		def_moveSpeed = moveSpeed;
		if (lockMoveSpeedMod == 0.0f)
			lockMoveSpeedMod = 0.3f;
		if (camSpeed == 0.0f)
			camSpeed = 8.0f;
		def_camSpeed = camSpeed;
		//if (AtkTmrMax = 0.0f)
		//AtkTmrMax = 1.0f;
		if (AnimMods == null)
		{
			if (tag == "Player")
			{
				InitAnimTable();
				InitAnimMods();
			}
			else if (tag == "Enemy")
			{
				InitAnimTableEnemy();
				InitAnimModsEnemy();
			}
		}
		NextAttack = State.IDLE; // cant set to null =(

		if (Input_AltScript == null)
			Input_AltScript = GetComponent<PlayerInput_Alt>();
		if (InputScript == null)
			InputScript = GetComponent<PlayerInput>();

		if (DgeTmrMax == 0.0f)
			DgeTmrMax = 0.5f;
		if (GrdTmrMax == 0.0f)
			GrdTmrMax = 0.2f;

		InitStateTable();

		moveTest = Vector3.zero;
		moveTest.x = 1.0f;
		moveTest.z = 1.0f;
		camTest = Vector3.zero;
		camTest.x = 1.0f;
		camTest.z = 1.0f;

		//debugAngle = 0.0f;

		if (tag == "Player")
			camScript.Initialize(this);
		attackScript.Initialize(this);
		dodgeScript.Initialize(this);
		guardScript.Initialize(this);
		rhScript.Initialize(this);
	}