/// <summary> /// Changes states with a flower to their corresponding dirt states /// </summary> private void GetPicked() { switch (state) { case FlowerState.Dirt: break; case FlowerState.WateredDirt: break; case FlowerState.Seeds: break; case FlowerState.WateredSeeds: break; case FlowerState.Flower: Game1.particleManager.AddGenericParticleSystem(new AnimatedTexture(0, 16, 16, Game1.staticTextureManager["LeafParticle"]), position); state = FlowerState.Dirt; break; case FlowerState.WateredFlower: Game1.particleManager.AddGenericParticleSystem(new AnimatedTexture(0, 16, 16, Game1.staticTextureManager["LeafParticle"]), position); state = FlowerState.WateredDirt; break; case FlowerState.HeldFlower: break; } }
IEnumerator DigAndWait() { if (_flowerState == FlowerState.Idle) { _flowerState = FlowerState.Digging; _animator.Play(_animationId[0]); //Rör sig lite, kallar på animatorn, och gör sig liten. if (event_Digging != null) { RuntimeManager.PlayOneShotAttached(event_Digging, gameObject); } float time = 0.0f; while (time < _hideTime) { time += Time.deltaTime; if (_playerInArea && !CharacterState.IsAbilityFlagActive(ABILITY_FLAG.INVISSIBLE) && !CharacterState.IsAbilityFlagActive(ABILITY_FLAG.CALM_ALL_FLOWERS)) { time = 0.0f; } yield return(null); } _animator.Play(_animationId[1]); if (event_Digging != null) { RuntimeManager.PlayOneShotAttached(event_Emerging, gameObject); } //Detta innebär att blomman är i "Idle" när den gräver upp, vilket kan skapa problem i framtiden. _flowerState = FlowerState.Idle; } }
/// <summary> /// Gets or sets <c>AnimatedTexture</c>s of the Flower, indexed by state /// </summary> /// <param name="s">The state the flower is in</param> /// <returns>The <c>AnimatedTexture</c> for that state of the chicken</returns> public AnimatedTexture this[FlowerState s] { get { return(textures[s]); } }
public override void GoToPast() { switch (state) { case FlowerState.Dirt: break; case FlowerState.WateredDirt: state = FlowerState.Dirt; break; case FlowerState.Seeds: break; case FlowerState.WateredSeeds: state = FlowerState.Seeds; break; case FlowerState.Flower: state = FlowerState.WateredSeeds; break; case FlowerState.WateredFlower: state = FlowerState.Flower; break; case FlowerState.HeldFlower: break; } }
protected void TransitionToOpened() { if (this.glower.DestroyedOrNull() == false) { Log.Warning("glower is not null at " + this.Position.ToString()); // TODO: remove this. } this.glower = GenSpawn.Spawn(Util_CaveworldFlora.GetGlowerStaticDef(this.def), this.Position); this.flowerState = FlowerState.opened; }
public void SetState(FlowerState state) { if (this.state != state && this.state != FlowerState.None) { animator.SetBool(this.state.ToString(), false); } if (state != FlowerState.None) { animator.SetBool(state.ToString(), true); } this.state = state; }
private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag == "Player") { if (flowerState == FlowerState.closed && openingFlower) { flowerState = FlowerState.open; anim_c.SetTrigger("interact"); ps_open.Play(); } else if (flowerState == FlowerState.open && !openingFlower) { flowerState = FlowerState.closed; anim_c.SetTrigger("interact"); ps_closing.Play(); } } }
protected void TransitionToOpened() { this.glower = GenSpawn.Spawn(Util_CaveworldFlora.GetGlowerStaticDef(this.def), this.Position, this.Map); this.flowerState = FlowerState.opened; }
protected void TransitionToOpening() { this.flowerScale = new Vector3(0f, 1f, 0f); this.flowerOpeningTicks = 0; this.flowerState = FlowerState.opening; }
public void SetState(FlowerState state) { flowerState.SetState(state); }
private void Awake() { wanderstate = new WanderState(this); flowerstate = new FlowerState(this); hoverstate = new HoverState(this); }
protected void TransitionToClosed() { this.nextNearbyPawnCheckTick = Find.TickManager.TicksGame + pawnDetectionPeriodWhenClosedInTicks; this.flowerState = FlowerState.closed; }
protected void TransitionToClosing() { TryToDestroyGlower(); this.flowerClosingRemainingTicks = flowerClosingDurationInTicks; this.flowerState = FlowerState.closing; }
/// <summary> /// Creates a flower at given position and at given state. Uncollidable by default. /// </summary> /// <param name="position">The starting position of the chicken</param> /// <param name="state">The starting state of the chicken</param> /// <param name="scale"></param> public Flower(Rectangle position, FlowerState state, double scale, Level level) : base(position, true, scale, level) { this.state = state; textures = LoadTextures <FlowerState>(0); }