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 SetPlayerBody(int bodyId) { AnimGroup animGroup = Resources.Load <AnimGroup>("Animations" + SLASH + "Groupings" + SLASH + "Body" + SLASH + bodyId); if (animGroup != null) { m_spriteHeight = animGroup.GetSpriteHeight(); m_spriteWidth = animGroup.GetSpriteWidth(); UpdatePlayerNamePosition(m_spriteHeight); UpdateStatBarSize(); UpdateSpellTargetSize(); m_bodyId = bodyId; if (!ShowPlayerEquipment()) { SetPlayerPoseEnum(AnimAttackType.Fist); ClearPlayerAppearance(); } GearSocket gearSocket = GetGearSocketWithName("Body"); if (gearSocket != null) { gearSocket.Equip(animGroup, m_attackType); } } }