public IEnumerator EmbiggenEffect(GameObject Unit) { float timer = 1f; float cTimer = 0f; Vector3 initalUnitScale = Unit.transform.localScale; Vector3 finalUnitScale = new Vector3( initalUnitScale.x * 1.25f, initalUnitScale.y * 1.25f, initalUnitScale.y * 1.25f ); while (cTimer < timer) { if (Unit != null) { Unit.transform.localScale = Vector3.Lerp( initalUnitScale, finalUnitScale, cTimer / timer ); } cTimer += Time.deltaTime; yield return(null); } if (Unit != null) { Unit.transform.localScale = finalUnitScale; JumpingUnit ju = Unit.GetComponent <JumpingUnit>(); if (ju != null) { ju.GroundCheckDistance = ju.GroundCheckDistance * 1.25f; ju.Body.mass = ju.Body.mass * 1.05f; ju.JumpForce = new Vector2( ju.JumpForce.x, ju.JumpForce.y * 1.2f ); } DamagableUnit du = Unit.GetComponent <DamagableUnit>(); if (du != null) { du.Hp += 10; } WizardBehaviour wb = Unit.GetComponent <WizardBehaviour>(); if (wb != null) { wb.FireballSpellScale = finalUnitScale; } } }
void Awake() { if (WizardAvatar != null) { m_wizardBehaviour = WizardAvatar.GetComponent <WizardBehaviour>(); m_wizardDeathBehaviour = WizardAvatar.GetComponent <WizardDeathBehaviour>(); m_wizardBehaviour.SetWizardType(true, true); } foreach (var a in m_alphabet) { try { m_keyCodes.Add((KeyCode)Enum.Parse(typeof(KeyCode), a.ToString(), true)); } catch (Exception) { Debug.LogError("Unable to parse: " + a); } } }
// Use this for initialization void Start() { m_wizardBehaviour = GetComponent <WizardBehaviour>(); m_wizardBehaviour.SetWizardType(false, false); StartCoroutine(AttackRoutine()); }