Exemple #1
0
    //____________________________
    // Get a Formation transform within a side
    //____________________________
    public Transform GetFormationTransform(CombatLogic.FormationSide side, string formation_name)
    {
        Transform team_transform      = GetTeamTransform(side);
        Transform formation_transform = team_transform.Find(formation_name);

        //if (formation_transform == null)
        //{
        //    EB.Debug.LogError("Failed to find formation " + side.ToString() + " - " + formation_name);
        //}
        return(formation_transform);
    }
Exemple #2
0
    //____________________________
    // Get a Position transform within a Formation
    //____________________________
    public Transform GetPositionTransform(CombatLogic.FormationSide side, string formation_name, string position_name)
    {
        Transform formation_transform = GetFormationTransform(side, formation_name);
        Transform position_transform  = formation_transform.Find(position_name);

        //if (position_transform == null)
        //{
        //    EB.Debug.LogError("Failed to find position " + side.ToString() + " - " + formation_name + " - " + position_name);
        //}
        return(position_transform);
    }
Exemple #3
0
    public Transform GetTeamTransform(CombatLogic.FormationSide side)
    {
        Transform team_transform = null;

        switch (side)
        {
        case CombatLogic.FormationSide.PlayerOrChallenger:
        {
            if (m_PlayerSide == null)
            {
                m_PlayerSide = gameObject.transform.Find("PlayerOrChallengerSide");
                if (m_PlayerSide == null)
                {
                    EB.Debug.LogError("Failed to find formations team transform PlayerSide");
                }
            }
            team_transform = m_PlayerSide;
            break;
        }

        case CombatLogic.FormationSide.Opponent:
        {
            if (m_OpponentSide == null)
            {
                m_OpponentSide = gameObject.transform.Find("OpponentSide");
                if (m_OpponentSide == null)
                {
                    EB.Debug.LogError("Failed to find formations team transform OpponentSide");
                }
            }
            team_transform = m_OpponentSide;
            break;
        }
        }

        return(team_transform);
    }
Exemple #4
0
        public static Transform GetBodyPartTransform(Animator animator, BodyPart bodyPart, string customPath = "")
        {
            switch (bodyPart)
            {
            case BodyPart.Root:
                return(animator.transform);

            case BodyPart.LeftProp:
                return(animator.GetBoneTransform(HumanBodyBones.LeftHand).Find("LeftProp"));

            case BodyPart.RightProp:
                return(animator.GetBoneTransform(HumanBodyBones.RightHand).Find("RightProp"));

            case BodyPart.Custom:
            {
                if (customPath.Length > 0)
                {
                    Transform transform = animator.transform.Find(customPath);
                    if (transform == null)
                    {
                        int index = customPath.LastIndexOf('/');
                        index = System.Math.Min(customPath.Length - 1, System.Math.Max(0, index + 1));
                        string path = customPath.Substring(index);

                        GameObject tempgo = EB.Util.GetObject(animator.gameObject, path);
                        if (tempgo != null)
                        {
                            transform = tempgo.transform;
                        }
                        else
                        {
                            EB.Debug.LogError("Not GetBodyPartTransform For:customPath={0}", customPath);
                            transform = animator.transform;
                        }
                    }

                    return(transform);
                }
                else
                {
                    return(animator.transform);
                }
            }

            case BodyPart.FXRoot:
                return(animator.GetComponent <FXHelper>().FXRootTransform);

            case BodyPart.HeadNub:
                return(animator.GetComponent <FXHelper>().HeadNubTransform);

            case BodyPart.ChestNub:
                return(animator.GetComponent <FXHelper>().ChestNubTransform);

            case BodyPart.FootNub:
                return(animator.GetComponent <FXHelper>().FootNubTransform);

            case BodyPart.HealthBar:
                return(animator.GetComponent <FXHelper>().HealthBarTransform);

            case BodyPart.HeadNubNotRot:
                return(animator.transform);

            case BodyPart.EnemyCenter:
                if (GameEngine.Instance != null)
                {
                    //if(animator.GetComponent<Combatant>().Data.TeamId== CombatLogic.Instance.LocalPlayerTeamIndex)
                    //{
                    CombatLogic.FormationSide side = CombatLogic.Instance.GetSide(1 - animator.GetComponent <Hotfix_LT.Combat.Combatant>().Data.TeamId);
                    return(Formations.Instance.GetPositionTransform(side, "1", "1"));
                    //}
                    //else
                    //{
                    //	CombatLogic.FormationSide side = CombatLogic.Instance.GetSide(CombatLogic.Instance.LocalPlayerTeamIndex);
                    //  return Formations.Instance.GetPositionTransform(side, "1", "1");
                    //}
                }
                else
                {
                    return(animator.transform);
                }

            case BodyPart.FriendCenter:
                if (GameEngine.Instance != null)
                {
                    //if (animator.GetComponent<Combatant>().Data.TeamId == CombatLogic.Instance.LocalPlayerTeamIndex)
                    //{
                    CombatLogic.FormationSide side = CombatLogic.Instance.GetSide(animator.GetComponent <Hotfix_LT.Combat.Combatant>().Data.TeamId);
                    return(Formations.Instance.GetPositionTransform(side, "1", "1"));
                    //}
                    //else
                    //{
                    //	CombatLogic.FormationSide side = CombatLogic.Instance.GetSide(1-CombatLogic.Instance.LocalPlayerTeamIndex);
                    //	return Formations.Instance.GetPositionTransform(side, "1", "1");
                    //}
                }
                else
                {
                    return(animator.transform);
                }

            case BodyPart.SceneRoot:
                return(null);

            default:
                HumanBodyBones bone = (HumanBodyBones)bodyPart;
                return(animator.GetBoneTransform(bone));
            }
        }