/// <summary> /// definies the behavior of the icebock on a push. this function will check if the iceblock should be moving or should be destroyed /// </summary> /// <param name="pusherPosition">the position of the object who wants to move the iceblock</param> public void push(Vector3 pusherPosition) { Debug.Log("Push Called!"); if (world == null && worldMockUp != null) { // Find info for movement from world; destinationForSlide = worldMockUp.getDestinationForIceblock(this, pusherPosition); } else if (world == null) { throw new Exception("You must call \"ThisIsMe\" after creating this object or the movement won't work!"); } else { // Find info for movement from world; destinationForSlide = world.getDestinationForIceblock(this, pusherPosition); } // if destination is the same as position destroy block; velocity = speedOfIceBlock * (destinationForSlide - transform.position).normalized; // check for 0 currentState = IceBlockState.Moving; }