MrPonton wrote:The system isn't designed with it in mind, no. Sorry.
However, off the top of my head.... you'd create a custom script to the character's prefab that knows where the sprite renderer is being played. If the character is being mirrored in UFE (forgive me because at the moment I forget the exact check but it's something like the character's active controlsScript.mirror. 1 is I believe Player 1 side and -1 is Player 2 side. Assuming that's the case, you could do a check that if the player is being mirrored, then alter the frame in the sprite renderer to the alt. I'd imagine you'd some how make the sprite names formulaic to easily tell when a sprite name is being used, then tell it to switch to the alt. or you can create an array in the same custom script of all the possible adjusted sprites and what to switch them to?
Anyways, that's the best i was able to come up with off the top of my head.
Thanks for the reply!
I've gotten far enough into development where I wished I fixed this earlier rather than later. I definitely agree with the methodology in terms of taking the Mirror data from the ControlsScript. I was thinking it may be easier to load a Stance (Stance 2) with the P2 sprites, have a custom script read whether the character is on P1 side (1) or P2 side (-1) and then switch between the stance 1 and 2 accordingly. This would be the easiest solution in my mind(at least theoretically), however I'm having trouble finding how to code this.
This code is probably not right, but here's an example of what I'm thinking of.
public void CharacterOrientation
{
if (controlsScript.mirror == 1 && moveSetScript.currentCombatStance == CombatStances.Stance1)
{
controlsScript.stanceChange.casted = false;
}
else if (controlsScript.mirror == 1 && moveSetScript.curentCombatStance == CombatStances.Stance2)
{
myMoveSetScript.ChangeMoveStances(stanceChange.Stance1);
controlsScript.stanceChange.casted = true;
}
else if (controlsScript.mirror == -1 && moveSetScript.curentCombatStance == CombatStances.Stance1)
{
myMoveSetScript.ChangeMoveStances(stanceChange.Stance2);
controlsScript.stanceChange.casted = true;
}
else
{
controlsScript.stanceChange.casted = false;
}
return;
}
Alternatively this may not even need a custom script, as it could (theoretically) be directly implemented into the MoveSetScript, making it a singular instance code where it just picks up on the character's stance and side of the stage, rather than having to go tell a custom script to look for specific sprites for each character.
Here's my example, although I'm not necessarily sure that void Awake is the correct place to put it. Right now it's only loading Stance1 for P1 and Stance2 for P2, not switching as I move one character to the other side.
void Awake()
{
controlsScript = transform.parent.gameObject.GetComponent<ControlsScript>();
hitBoxesScript = GetComponent<HitBoxesScript>();
spriteRenderer = GetComponent<SpriteRenderer>();
List<MoveSetData> loadedMoveSets = new List<MoveSetData>();
foreach (MoveSetData moveSetData in controlsScript.myInfo.moves)
{
loadedMoveSets.Add(moveSetData);
}
foreach (string path in controlsScript.myInfo.stanceResourcePath)
{
loadedMoveSets.Add(Resources.Load<StanceInfo>(path).ConvertData());
}
controlsScript.loadedMoves = loadedMoveSets.ToArray();
controlsScript.currentCombatStance = CombatStances.Stance10;
ChangeMoveStances(CombatStances.Stance1);
if (controlsScript.playerNum == 1)
{
if (controlsScript.mirror < 0)
ChangeMoveStances(CombatStances.Stance2);
else
ChangeMoveStances(CombatStances.Stance1);
}
else
{
if (controlsScript.mirror > 0)
ChangeMoveStances(CombatStances.Stance1);
else
ChangeMoveStances(CombatStances.Stance2);
}
}