public void OnCollisionEnter(Collider other) { if (other.GameObject.GetComponent("Player") != null) { SpriteRenderer spriteRenderer = (SpriteRenderer)GameObject.GetComponent("SpriteRenderer"); color = Color.Red; spriteRenderer.Color = color; int j = GameWorld.GameObjects.Count; for (int i = 0; i < j; i++) { GameObject go = GameWorld.GameObjects[i]; if (go.GetComponent("Door") != null) { Door localDoor = (Door)go.GetComponent("Door"); if (localDoor.Name == name) { GameWorld.Instance.RemoveGameObjects.Add(go); } } } } }
public void OnCollisionExit(Collider other) { if (other.GameObject.GetComponent("MoveableBox") != null) { SpriteRenderer spriteRenderer = (SpriteRenderer)GameObject.GetComponent("SpriteRenderer"); color = Color.Red; spriteRenderer.Color = color; } }
public void OnCollisionEnter(Collider other) { if(other.GameObject.GetComponent("Player") != null) { if (GameWorld.Instance.Level == "level 2") { GameWorld.Instance.Completed = true; GameWorld.Instance.Level = "level 3"; } if (GameWorld.Instance.Level == "level 1") { GameWorld.Instance.Completed = true; GameWorld.Instance.Level = "level 2"; } } }
public void OnCollisionEnter(Collider other) { if (other.GameObject.GetComponent("Player") == null && other.GameObject.GetComponent("Gift") == null && other.GameObject.GetComponent("BoxPreassurePlate") == null && other.GameObject.GetComponent("PreassurePlate") == null) { strategy = new Idle(animator, transform); strategy.Update(ref playerDirection); player.OnCollisionEnter(other); } else if (other.GameObject.GetComponent("Player") != null) { player = (Player)other.GameObject.GetComponent("Player"); playerDirection = player.Direction; strategy = new MoveBox(animator, transform); strategy.Update(ref playerDirection); } }
public void OnCollisionExit(Collider other) { // Debug.Write("exit gift/level"); }
public void OnCollisionExit(Collider other) { strategy = new Idle(animator, transform); }
public void OnCollisionExit(Collider other) { }
public void OnCollisionEnter(Collider other) { if (other.GameObject.GetComponent("PreassurePlate") != null) { } else if (other.GameObject.GetComponent("MoveableBox") != null) { } else if(other.GameObject.GetComponent("BoxPreassurePlate") != null) { } else if (other.GameObject.GetComponent("Gift") != null) { } if(other.GameObject.GetComponent("Gift") == null && other.GameObject.GetComponent("BoxPreassurePlate") == null && other.GameObject.GetComponent("PreassurePlate") == null && other.GameObject.GetComponent("MoveableBox") == null) { if (direction == Direction.Front) { oppositeDirection = Direction.Back; } else if (direction == Direction.Back) { oppositeDirection = Direction.Front; } else if (direction == Direction.Right) { oppositeDirection = Direction.Left; } else if (direction == Direction.Left) { oppositeDirection = Direction.Right; } strategy.Update(ref oppositeDirection); } }