public void SetState(ISerialDataStore state) { SaveBulletMan past = (SaveBulletMan)state; bulletIndex = past.bulletIndex; nextFire = past.nextFire; }
public void SetState(ISerialDataStore state) { SaveUI past = (SaveUI)state; IsAlive = past.IsAlive; filterImg.enabled = past.filterImgEnabled; filterImg.color = GetAlphaChange(filterImg, past.alphaFilter); deathText.enabled = past.deathTextEnabled; deathText.color = GetAlphaChange(deathText, past.alphaText); deathAnimationTrigger = past.deathAnimationTrigger; timeBar.transform.position = new Vector2(past.timeBarPositionX, past.timeBarPositionY); timeBar.transform.localScale = new Vector2(past.timeBarScale, past.timeBarScale); Time.timeScale = past.timeScale; pastStates.TogglePause(past.isPaused); rewindPrompt.enabled = past.rewindPrompting; restartPrompt.enabled = past.restartPrompting; outOfJuiceText.enabled = past.outOfJuicing; rewindPrompt.color = GetAlphaChange(rewindPrompt, past.rewindPromptAlpha); restartPrompt.color = GetAlphaChange(restartPrompt, past.restartPromptAlpha); outOfJuiceText.color = GetAlphaChange(outOfJuiceText, past.outOfJuiceAlpha); }
/* * CollectStates - gets the current state from each serialize object */ ISerialDataStore[] CollectStates() { ISerialDataStore[] allCurrentStates = new ISerialDataStore[allSerialObjects.Length]; for (int i = 0; i < allSerialObjects.Length; i++) { allCurrentStates[i] = allSerialObjects[i].GetCurrentState(); } return(allCurrentStates); }
public void SetState(ISerialDataStore state) { SaveBullet past = (SaveBullet)state; isInPlay = past.isInPlay; timeLeftInPLay = past.timeLeftInPLay; rb.velocity = new Vector2(past.velocityX, past.velocityY); transform.position = new Vector2(past.positionX, past.positionY); IsMovingRight = past.IsMovingRight; if (past.IsMovingRight) { transform.localScale = new Vector3(1, 1, 1); } else { transform.localScale = new Vector3(-1, 1, 1); } }
public void SetState(ISerialDataStore state) { SavePlayer past = (SavePlayer)state; isExitingRewind = true; rb.isKinematic = true; rb.velocity = Vector2.zero; // Needed to cancel velocity applied during rewind acceleration = past.acceleration; velocityX = past.velocityX; velocityY = past.velocityY; IsMovingRight = past.IsMovingRight; lastX = past.lastX; isEitherDown = past.isEitherDown; isLeftDown = past.isLeftDown; isRightDown = past.isRightDown; isLeftDown = past.isLeftUp; isRightUp = past.isRightUp; isGrounded = past.grounded; jumps = past.jumps; wallJumps = past.wallJumps; canWallJump = past.canWallJump; coolDownJump = past.coolDownJump; jumpBuffer = maxJumpBuffer; transform.position = new Vector3(past.positionX, past.positionY, transform.position.z); rightHorizontalAxisDown = past.rightHorizontalAxisDown; leftHorizontalAxisDown = past.leftHorizontalAxisDown; rb.freezeRotation = past.freezeRotation; rb.rotation = past.rotation; transform.localScale = new Vector3(past.localXScale, 1, 1); }
public void SetState(ISerialDataStore state) { SaveEnemy past = (SaveEnemy)state; isMovingRight = past.isMovingRight; isGrounded = past.isGrounded; isAlive = past.isAlive; timeLeftInPlay = past.timeLeftInPlay; transform.position = new Vector3(past.positionX, past.positionY, 0); // Don't use rigid body to update or it will be jitters rb.velocity = Vector2.zero; rb.isKinematic = past.isKinematic; rb.angularVelocity = 0f; // Can't use rb.rotation due to it causing jittery movement // Have to convert normal 2d rotation to 3d to use transform.rotation // The 2D rotation value is actually along the Z-Axis Vector3 currentRot = transform.rotation.eulerAngles; Vector3 newRot = new Vector3(currentRot.x, currentRot.y, past.rotation); transform.rotation = Quaternion.Euler(newRot); }
public void SetState(ISerialDataStore state) { SaveCloud past = (SaveCloud)state; transform.position = new Vector3(past.positionX, transform.position.y, transform.position.z); }
public void SetState(ISerialDataStore state) { SaveSceneController past = (SaveSceneController)state; jumpTriggersRestart = past.jumpTriggersRestart; }
public void SetState(ISerialDataStore state) { SaveCamera past = (SaveCamera)state; transform.position = new Vector3(past.positionX, past.positionY, -10); }