void HandleCarry() { m_carrier = null; if (m_onGround) { for (int i = 0; i < m_motor.m_RaysGround.Length; i++) { if (m_motor.m_RaysGround [i].m_collider) { APCarrier curCarrier = m_motor.m_RaysGround [i].m_collider.GetComponent <APCarrier>(); if (curCarrier != null) { // use prefer index if carrier is already assigned if ((m_carrier == null) || (i == m_carryRayIndex)) { m_carrier = curCarrier; } } } } // for now move player by position // todo : we should move by velocity properly and detect collision by the way, must be in future release ! if (m_carrier != null) { Vector2 carrierOffset = m_carrier.GetVelocity() * Time.deltaTime; transform.position += new Vector3(carrierOffset.x, carrierOffset.y, 0f); } } }
void ClearRuntimeValues() { m_carrier = null; m_jumpDown = false; m_isControlled = false; m_onGround = false; m_animAirTime = m_animations.m_minAirTime; m_speedFactor = 1f; m_lastJumpTime = 0f; m_crouchBoxOriginalSize = 1f; m_crouchBoxOriginalCenter = 0f; m_groundSpeed = 0f; m_sliding = false; m_curAttackId = -1; m_attackCrouched = false; m_jumpButtonTimeDown = 0f; foreach (APMeleeAttack curAttack in m_meleeAttacks.m_attacks) { curAttack.timeDown = 0f; curAttack.inputStatus = false; } SetState(State.Standard); }
void Start() { m_moving = false; m_hasTouched = false; m_touchTime = 0f; m_animation = GetComponent <Animation>(); // make sure to enable carrier automatic mode if any APCarrier pCarrier = GetComponent <APCarrier>(); if (pCarrier != null) { pCarrier.m_animationMode = true; } }
void Start() { // init start position m_startPosX = transform.position.x; m_startPosY = transform.position.y; m_curSpeed = 0f; m_rigidBody = GetComponent <Rigidbody2D>(); // make sure to disable carrier automatic mode if any APCarrier pCarrier = GetComponent <APCarrier>(); if (pCarrier != null) { pCarrier.m_animationMode = false; } }