public void Fire(Charicter me, float xVel, float yVel, HitBoxManager hitBoxManager, float activeTime) { m_position[0] = me.getX(); m_position[1] = me.getY() + 1.5f; m_velocity[0] = xVel; m_velocity[1] = yVel; m_active = true; m_timer = activeTime; m_sprite.enabled = true; m_hitboxID = hitBoxManager.addHitbox(m_position[0], m_position[1] - 1.0f, 2.0f, 4.0f, 3, -4.0f, 8.0f, 0.75f, 0.2f, eAttackType.PROJECTILE); }
// Use this for initialization public void Initialize(SpriteRenderer sprite) { m_tansform = GetComponent <Transform>(); m_hitboxManager = GetComponent <HitBoxManager>(); m_sprite = sprite; m_position[0] = m_tansform.position.x; m_position[1] = m_tansform.position.y; //m_height = transform.localScale.y /** 0.5f*/; //m_width = transform.localScale.x /** 0.5f*/; m_baseHeight = 2.4f; m_height = m_baseHeight; m_width = 1.0f; m_hitboxManager.Initialize(); }
// Update is called once per frame public virtual void Cycle(float deltaTime, HitBoxManager hitBoxManager) { if (m_active) { m_position[0] += m_velocity[0] * deltaTime; m_position[1] += m_velocity[1] * deltaTime; hitBoxManager.SetHitboxPos(m_hitboxID, m_position[0], m_position[1] - 1.0f); m_timer -= deltaTime; if (m_timer <= 0.0f) { hitBoxManager.removeHitbox(m_hitboxID); m_sprite.enabled = false; m_active = false; } m_tansform.position = new Vector3(m_position[0], m_position[1], 0.0f); } }
// Update is called once per frame public override void Cycle(float deltaTime, HitBoxManager hitBoxManager) { base.Cycle(deltaTime, hitBoxManager); m_timerI -= deltaTime; if (m_timerI <= 0.0f) { //Debug.Log("Rotate"); m_timerI = m_turnTime; //m_tansform.Rotate(90.0f, 0.0f, 0.0f); m_Rotation += 0.25f; //90.0f; //m_tansform.rotation = new Quaternion(0.0f, 0.0f, m_Rotation, 0.0f); //transform.Rotate(Vector3.forward * -90); //transform.Rotate(Vector3.up * -90); //transform.Rotate(Vector3.left * -90); //transform.localRotation = new Quaternion(0.0f, 0.0f, m_Rotation, 0.0f); m_tansform.Rotate(m_Rotation, m_Rotation, m_Rotation); } }
// Use this for initialization void Start() { speed = 1200; finished = false; jumps = 0; xvelocity = 0; yvelocity = 0; anim = GetComponent <Animator>(); if (right == null) { right = true; } hitboxmanager = this.gameObject.GetComponentInChildren <HitBoxManager> (); hurtboxmanager = this.gameObject.GetComponentInChildren <HurtBoxManager> (); raycastJumpLength = 0.1f; thrown = false; hit = false; jumpReleased = true; heavyAttackReleased = true; lightAttackReleased = true; dodgeReleased = true; health = gameObject.GetComponent <Health> (); }
// Start is called before the first frame update void Start() { myHitBoxManager = FindObjectOfType <HitBoxManager>(); myInput = FindObjectOfType <ControllerManagerScript>(); myController = myInput.controllers[controllerPosition].GetComponent <ControllerScript>(); }
// Use this for initialization void Start() { speed = 1200; finished = false; jumps = 0; xvelocity = 0; yvelocity = 0; anim = GetComponent<Animator>(); if (right == null) { right = true; } hitboxmanager = this.gameObject.GetComponentInChildren<HitBoxManager> (); hurtboxmanager = this.gameObject.GetComponentInChildren<HurtBoxManager> (); raycastJumpLength = 0.1f; thrown = false; hit = false; jumpReleased = true; heavyAttackReleased = true; lightAttackReleased = true; dodgeReleased = true; health = gameObject.GetComponent<Health> (); }