void UpdateCatcherState() { if (!hasCapsule) { currentPortions.Clear(); currentCatcherState = CatcherState.EMPTY; //skinnedMesh.material.color = Color.clear; } else if (currentPortions.Count == 0) { currentCatcherState = CatcherState.EMPTY_CAPSULE; } else if (currentPortions.Count == 1) { currentCatcherState = CatcherState.FILLED_1; } else if (currentPortions.Count == 2) { currentCatcherState = CatcherState.FILLED_2; } else if (currentPortions.Count == 3) { currentCatcherState = CatcherState.FILLED_3; } else if (currentPortions.Count == 4) { currentCatcherState = CatcherState.FILLED_4; } else if (currentPortions.Count == 5) { currentCatcherState = CatcherState.FULL_CAPSULE; } }
public void Start() { handUpLocal = transform.InverseTransformVector(hand.transform.up); handUpWorld = hand.transform.up; state = CatcherState.None; handOriginOffset = hand.transform.localPosition; oriLocalUp = transform.InverseTransformVector(hand.transform.up); }
public void Initialize(Texture2D[] texture, Vector2 position, CatcherState state, TimeSpan gameTime) { elapsedTime = 0; currentFrame = 0; Texture = texture; Position = position; State = state; Active = true; }
public void Initialize(Texture2D[] texture, Vector2 position, CatcherState state) { PlayerTexture = texture; Position = position; // Set the starting position of the player around the middle of thescreen and to the back State = state; // Set the player to be active Active = true; }
public void Caught(Mine mine = null) { if (state == CatcherState.Push) { if (mine != null) { temMine = mine; temMine.Caught(this); state = CatcherState.Caught; } else { state = CatcherState.Back; } } }
public void Back() { if (state == CatcherState.Back || state == CatcherState.Fly) { Debug.Log("Back"); state = CatcherState.None; if (temMine != null) { temMine.Collect(this); } if (parent != null) { parent.CollectMine(temMine); } temMine = null; } }
public void Initialize(Rectangle window, Texture2D[] textures, SoundEffect[] soundEffects, CatcherState trayNumber, TimeSpan createTime, TimeSpan pace) { this.textures = textures; lastStepTime = createTime; this.soundEffects = soundEffects; Pace = pace; TrayNumber = trayNumber; switch (trayNumber) { case CatcherState.BottomLeft: case CatcherState.TopLeft: stepDelta = new Vector2(25, 18); break; case CatcherState.BottomRight: case CatcherState.TopRight: stepDelta = new Vector2(-25, 18); break; } switch (trayNumber) { case CatcherState.TopLeft: Position = new Vector2(150, 270); break; case CatcherState.TopRight: Position = new Vector2(850, 270); break; case CatcherState.BottomRight: Position = new Vector2(900, 390); break; case CatcherState.BottomLeft: Position = new Vector2(100, 390); break; } StepNumber = 0; Crushed = false; }
public void Update(CatcherState state) { State = state; }
private void AddEgg(GameTime gameTime) { var egg = new Egg(); var textureSet = eggTextures[random.Next(3)]; var pace = TimeSpan.FromMilliseconds(1000); CatcherState trayNumber; do { trayNumber = (CatcherState)random.Next(1, 4); } while (trayNumber == prevTrayNumber); egg.Initialize(GraphicsDevice.Viewport.TitleSafeArea, textureSet, moveSounds, trayNumber, gameTime.TotalGameTime, pace); eggs.Add(egg); prevTrayNumber = trayNumber; }
private void AddCrushedEgg(GameTime gameTime, CatcherState position) { var crushedEgg = new CrushedEgg(); crushedEgg.Initialize(crushedEggTextures, playerPosition, position, gameTime.TotalGameTime); crushedEggs.Add(crushedEgg); }
public void Push() { state = CatcherState.Push; velocity = hand.transform.up * pushSpeed; }
public void UpdateHand() { parent.flyTo = Vector3.zero; if (state == CatcherState.None) { hand.transform.position = handOrigiPosWorld; toHand = hand.transform.up; } else if (state == CatcherState.Push) { hand.transform.position = preHandPos + velocity * Time.deltaTime; toHand = (hand.transform.position - handOrigiPosWorld); hand.transform.up = toHand.normalized; //rope.transform.up = toHand.normalized; //rope.size = new Vector2(0.2f, toHand.magnitude); if (toHand.magnitude > maxRopeLength) { Caught(); } } else if (state == CatcherState.Caught) { state = CatcherState.Fly; } else if (state == CatcherState.Fly) { toHand = temMine.transform.position - handOrigiPosWorld; hand.transform.position = temMine.transform.position; //Vector3 backHand = - toHand * backSpeed * Time.deltaTime; //backHand = Vector3.ClampMagnitude(backHand, pushSpeed * 2f); //toHand *= (1f - backSpeed * Time.deltaTime); //hand.transform.position = handOrigiPosWorld + toHand; Vector3 flyTo = toHand * flySpeed; parent.flyTo = flyTo; hand.transform.up = toHand.normalized; if (toHand.magnitude < backOffset) { Back(); } } if (state == CatcherState.Back) { toHand = preHandPos - handOrigiPosWorld; Vector3 backHand = -toHand * backSpeed * Time.deltaTime; backHand = Vector3.ClampMagnitude(backHand, pushSpeed * 2f); toHand *= (1f - backSpeed * Time.deltaTime); hand.transform.position = handOrigiPosWorld + toHand; hand.transform.up = toHand.normalized; if (toHand.magnitude < backOffset) { Back(); } } realHandVelocity = (hand.transform.position - preHandPos) / Time.deltaTime; preHandPos = hand.transform.position; }