public void Equip(AnimGroup animGroup, AnimAttackType animAttackType, Color color) { float flashAmount = color.a; Color flashColor = new Color(color.r, color.g, color.b, 1f); m_spriteRenderer.material.SetFloat("_FlashAmount", flashAmount); m_spriteRenderer.material.SetColor("_FlashColor", flashColor); m_spriteRenderer.material.SetColor("_Color", m_tintColor); m_spriteRenderer.color = Color.white; m_spriteRenderer.sprite = null; m_animGroup = animGroup; m_animAttackType = animAttackType; m_animColor = color; if (m_animGroup != null) { float spriteHeight = m_animGroup.GetSpriteHeight(); Vector3 pos = transform.localPosition; pos.y = -Mathf.Max((spriteHeight - 1.5f) / 2, 0f); transform.localPosition = pos; animGroup.UpdateAnimator(m_animatorOverrideController, m_animAttackType); } else { ClearAnimator(m_animatorOverrideController, m_animAttackType); } }
public void SetAttackType(AnimAttackType animAttackType) { m_animAttackType = animAttackType; if (m_animGroup != null) { m_animGroup.UpdateAnimator(m_animatorOverrideController, m_animAttackType); } }