protected void Awake() { foreach (string orientation in Orientation.ALL_SIMPLE) //Donc: on ne permet pas de shifts en diagonale { shifts[orientation] = new ShiftDescriptor(5, orientation); //TODO 5 arbitraire } _basePosition = transform.position; _spriteRenderer = GetComponent <SpriteRenderer>(); _animator = GetComponent <Animator>(); }
public void UseShiftForMovement(MoveDescriptor descriptor)//bien préciser que ça annule le shift et le passe sur le MD { ShiftDescriptor shiftDescriptor = shifts[descriptor.orientation]; Vector2 shiftUntilNow = shiftDescriptor.Lookup(); shiftDescriptor.Cancel(); if (!Utils.FloatComparison(shiftUntilNow.x, 0.0f, 0.0001f)) { descriptor.retrieveXShift(shiftUntilNow.x); } else if (!Utils.FloatComparison(shiftUntilNow.y, 0.0f, 0.0001f)) { descriptor.retrieveYShift(shiftUntilNow.y); } }