// Reset all the shrooms void ResetPuzzle() { foreach (Big_Mushroom Shroom in Mushrooms) { Shroom.ResetMushroom(); } }
public void SetShroom(Shroom shroom) { if (!iconImage) { iconImage = transform.Find("Image").GetComponent <Image>(); } this.shroom = shroom; iconImage.sprite = shroom.icon; }
public void CollisionDetection() { Character ch = this.character; Physics phys = ch.physics; // Setup Character phys.StopX(); phys.StopY(); // Reset the Character's Velocity phys.MoveToPos(600, 300); // Reset the Character's Position phys.SetGravity(FInt.Create(0)); phys.intend = FVector.Create(3, 3); // Setup Shroom Shroom shroom = new Shroom(this.roomScene, (byte)ShroomSubType.Black, FVector.Create(700, 300), null); shroom.physics.intend = FVector.Create(-1, -1); // Confirm that Physics Alignments, IsOverlapping, GetOverlapX, GetOverlapY are working correctly: shroom.physics.AlignRight(ch); Debug.Assert(CollideDetect.IsOverlapping(ch, shroom) == false); shroom.physics.MoveToPosX(shroom.posX - 1); Debug.Assert(CollideDetect.IsOverlapping(ch, shroom) == true); Debug.Assert(CollideDetect.GetOverlapX(ch, shroom, true) == 1); shroom.physics.AlignLeft(ch); Debug.Assert(CollideDetect.IsOverlapping(ch, shroom) == false); shroom.physics.MoveToPosX(shroom.posX + 1); Debug.Assert(CollideDetect.IsOverlapping(ch, shroom) == true); Debug.Assert(CollideDetect.GetOverlapX(shroom, ch, true) == 1); shroom.physics.AlignUp(ch); Debug.Assert(CollideDetect.IsOverlapping(ch, shroom) == false); shroom.physics.MoveToPosY(shroom.posY + 1); Debug.Assert(CollideDetect.IsOverlapping(ch, shroom) == true); Debug.Assert(CollideDetect.GetOverlapY(shroom, ch, true) == 1); shroom.physics.AlignDown(ch); Debug.Assert(CollideDetect.IsOverlapping(ch, shroom) == false); shroom.physics.MoveToPosY(shroom.posY - 1); Debug.Assert(CollideDetect.IsOverlapping(ch, shroom) == true); Debug.Assert(CollideDetect.GetOverlapY(ch, shroom, true) == 1); // Move Away (no longer overlapping, off by 2) shroom.physics.MoveToPosY(shroom.posY + 3); Debug.Assert(CollideDetect.GetOverlapY(ch, shroom, true) == -2); }
public void spawn_Grzyba() { Shroom grzyb = Instantiate(shroomPrefab, wylosuj_Pozycje(1), Quaternion.identity).GetComponent <Shroom>(); lista_grzybow.Add(grzyb); }