void Start() { hurtJumpAngle = Mathf.Clamp(hurtJumpAngle, k_MinHurtJumpAngle, k_MaxHurtJumpAngle); m_TanHurtJumpAngle = Mathf.Tan(Mathf.Deg2Rad * hurtJumpAngle); m_FlickeringWait = new WaitForSeconds(flickeringDuration); //meleeDamager.DisableDamage(); m_ShotSpawnGap = 1f / shotsPerSecond; m_NextShotTime = Time.time; m_ShotSpawnWait = new WaitForSeconds(m_ShotSpawnGap); if (!Mathf.Approximately(maxHorizontalDeltaDampTime, 0f)) { float maxHorizontalDelta = maxSpeed * cameraHorizontalSpeedOffset + cameraHorizontalFacingOffset; m_CamFollowHorizontalSpeed = maxHorizontalDelta / maxHorizontalDeltaDampTime; } if (!Mathf.Approximately(maxVerticalDeltaDampTime, 0f)) { float maxVerticalDelta = cameraVerticalInputOffset; m_CamFollowVerticalSpeed = maxVerticalDelta / maxVerticalDeltaDampTime; } SceneLinkedSMB <PlayerCharacter> .Initialise(m_Animator, this); m_StartingPosition = transform.position; m_StartingFacingLeft = GetFacing() < 0.0f; }
protected virtual void Start() { bloodSplatterParent = GameObject.Find("ParticlesParent") as GameObject; bloodSplatter = GameObject.Instantiate(bloodSplatter); bloodSplatter.transform.SetParent(transform); bloodSplatter.transform.localPosition = Vector3.zero; bloodSplatter.SetActive(false); SceneLinkedSMB <EnemyBehaviour> .Initialise(m_Animator, this); m_LocalBounds = new Bounds(); int count = m_CharacterController2D.Rigidbody2D.GetAttachedColliders(s_ColliderCache); for (int i = 0; i < count; ++i) { m_LocalBounds.Encapsulate(transform.InverseTransformBounds(s_ColliderCache[i].bounds)); } m_Filter = new ContactFilter2D(); m_Filter.layerMask = m_CharacterController2D.groundedLayerMask; m_Filter.useLayerMask = true; m_Filter.useTriggers = false; if (meleeDamager) { m_LocalDamagerPosition = meleeDamager.transform.localPosition; } }
void Start() { //variables vinculadas con cuando es herido hurtJumpAngle = Mathf.Clamp(hurtJumpAngle, k_MinHurtJumpAngle, k_MaxHurtJumpAngle); //AnguDañoSalto m_TanHurtJumpAngle = Mathf.Tan(Mathf.Deg2Rad * hurtJumpAngle); //AnguDañoSalto m_FlickeringWait = new WaitForSeconds(flickeringDuration); //la variable es de tipo Waitforseconds para poder ser llamada en la corutina y se le asigna el float de tiempo //hasta que te encontre madafoca, esta es la causante de que de entrada se desactive el ataque de m_CanDamage en Damager para el jugador //meleeDamager.DisableDamage();//Deshabilite el daño cuerpo a cuerpo m_ShotSpawnGap = 1f / shotsPerSecond; m_NextShotTime = Time.time; m_ShotSpawnWait = new WaitForSeconds(m_ShotSpawnGap); //Camara if (!Mathf.Approximately(maxHorizontalDeltaDampTime, 0f)) { float maxHorizontalDelta = maxSpeed * cameraHorizontalSpeedOffset + cameraHorizontalFacingOffset; m_CamFollowHorizontalSpeed = maxHorizontalDelta / maxHorizontalDeltaDampTime; } if (!Mathf.Approximately(maxVerticalDeltaDampTime, 0f)) { float maxVerticalDelta = cameraVerticalInputOffset; m_CamFollowVerticalSpeed = maxVerticalDelta / maxVerticalDeltaDampTime; } //Aca se inicializa el animador en la clase Scene.. de tipo <Player..> y llamamos la funcion Inicialise //pasandole (el animador del personaje, y el TipoMonoBehaviour que en este caso seria esta misma clase PlayerCharacter "This" que hereda de MonoBehaviour. //Esta instrucción solo es llamada una vez y por este script. SceneLinkedSMB <PlayerCharacter> .Initialise(m_Animator, this); m_StartingPosition = transform.position; m_StartingFacingLeft = GetFacing() < 0.0f; }
void Start() { hurtJumpAngle = Mathf.Clamp(hurtJumpAngle, k_MinHurtJumpAngle, k_MaxHurtJumpAngle); m_TanHurtJumpAngle = Mathf.Tan(Mathf.Deg2Rad * hurtJumpAngle); m_FlickeringWait = new WaitForSeconds(flickeringDuration); meleeDamager.DisableDamage(); //Ada Script ExperienceBar = GameObject.Find("ExperienceBar"); ExperienceBarSlider = GameObject.Find("ExperienceBarSlider"); XpBarFill = GameObject.Find("XpBarFill"); staminaBarFill = GameObject.Find("staminaBarFill"); staminaBarSlider = GameObject.Find("staminaBarSlider"); manaBarFill = GameObject.Find("manaBarFill"); manaBarSlider = GameObject.Find("manaBarSlider"); levelUpText = GameObject.Find("levelUpText"); levelUpText.SetActive(false); theSound = gameObject.AddComponent <AudioSource>(); HealthUI.ChangeHitPointUI(damageable); currentExperience = 0; characterLevel = 1; ExperienceBar.GetComponent <Text>().text = "" + characterLevel; XpBarFill.GetComponent <Text>().text = currentExperience + " / " + levelUpAmount; staminaBarFill.GetComponent <Text>().text = stamina + " / 100"; manaBarFill.GetComponent <Text>().text = mana + " / 100"; InvokeRepeating("RegenerationTick", 0.0f, 1.0f); //EndOf Ada Script m_ShotSpawnGap = 1f / shotsPerSecond; m_NextShotTime = Time.time; m_ShotSpawnWait = new WaitForSeconds(m_ShotSpawnGap); if (!Mathf.Approximately(maxHorizontalDeltaDampTime, 0f)) { float maxHorizontalDelta = maxSpeed * cameraHorizontalSpeedOffset + cameraHorizontalFacingOffset; m_CamFollowHorizontalSpeed = maxHorizontalDelta / maxHorizontalDeltaDampTime; } if (!Mathf.Approximately(maxVerticalDeltaDampTime, 0f)) { float maxVerticalDelta = cameraVerticalInputOffset; m_CamFollowVerticalSpeed = maxVerticalDelta / maxVerticalDeltaDampTime; } SceneLinkedSMB <PlayerCharacter> .Initialise(m_Animator, this); m_StartingPosition = transform.position; m_StartingFacingLeft = GetFacing() < 0.0f; }
private void Start() { SceneLinkedSMB <EnemyBehaviour> .Initialise(m_Animator, this); m_LocalBounds = new Bounds(); int count = m_CharacterController2D.Rigidbody2D.GetAttachedColliders(s_ColliderCache); for (int i = 0; i < count; ++i) { m_LocalBounds.Encapsulate(transform.InverseTransformBounds(s_ColliderCache[i].bounds)); } m_Filter = new ContactFilter2D(); m_Filter.layerMask = m_CharacterController2D.groundedLayerMask; m_Filter.useLayerMask = true; m_Filter.useTriggers = false; if (meleeDamager) { m_LocalDamagerPosition = meleeDamager.transform.localPosition; } }